Board index » delphi » Please Help: Published Properites and Pointer References??

Please Help: Published Properites and Pointer References??

Hello,

I'd appreciate if anyone can help me with this problem.

I have a custom panel component, MyPanel,  with a Published Property
of type String called 'FormName'.  This proptry can be changed during
designtime and runtime.  'FormName' contains the name of a form that
will appear inside MyPanel.

My question:  How do I use the value stored in the property FormName
to indirectly reference the form whose name is that value?

For example, at some point I'll need to change the form's parent to
that of the Custom Panel:

        MyPanel.FormName^.Parent := CustomForm   ??

Any suggestions?

Thanks in advance,
-Sterling Foiles
-Foundation Software

-to send email, remove the two X's:  XXssfoi...@texas.net

 

Re:Please Help: Published Properites and Pointer References??


Quote
fake_user@no_address.com wrote:

> I have a custom panel component, MyPanel,  with a Published Property
> of type String called 'FormName'.  This proptry can be changed during
> designtime and runtime.  'FormName' contains the name of a form that
> will appear inside MyPanel.

> My question:  How do I use the value stored in the property FormName
> to indirectly reference the form whose name is that value?

> For example, at some point I'll need to change the form's parent to
> that of the Custom Panel:

>         MyPanel.FormName^.Parent := CustomForm   ??

You can use for example:

function FindComponent(const AName: string): TComponent; :-)

f.e.:

MyComp := Application.FindComponent(MyPanel.FormName);
if(MyComp is TForm) then
  MyForm := TForm(MyComp);

Best regards
Andrey Telnov (RSD software - Delphi Components Developer)

Internet: http://www.rsd.pp.ru
E-mail: r...@tibc.tula.ru
Fax: ++7 0872 77018

Other Threads