Board index » cppbuilder » Problem dynamically creating frames within a COM server

Problem dynamically creating frames within a COM server

Hi,

has anyone had problems dynamically creating frame objects within an in-process
COM server (i.e. a DLL).

I have some code inside a COM server which creates a form and displays it.
Later, it dynamically creates some frames and places these on the form.

This works fine in the executable, but when attempting to do the same in a DLL,
I get the following exception :-

Exception EInvalidOperation with message 'Control 'TestFrame' has no parent
window'
This only happens when certain controls exist on the frame, for example the
error occurs, if I place a TMemo component on the frame.

Does anyone know why this is happening ?

Thanks in advance.
Phil.

 

Re:Problem dynamically creating frames within a COM server


Hi, Phil!

Some components require a parent before you set any of their values. It
is likely that when you create the frame, its internal components are
created and parented to it, and if their constructors or streaming
initialize the content of (for instance) a combo, then you might get
this message.

I'm not sure there's any workaround to this, except to have those
particular components not be instantiated until the called sets the
parent - in other words, have the form call the frame to create those
components after it has finished parenting the frame.

Sounds a little Rube Goldberg, and I'm not even sure that's your
problem, but it may give you somewhere to look.

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------

Other Threads