I use embedded forms in my application and I was trying something like this:
At designtime the form is a normal form which don't know anything about embedding/docking. With a ButtonClick I can make the form visible by calling the Show() method of the form. At runtime it can happen that the form gets docked into another form and becomes an embedded form. When I press the Button for showing the form again (which is now embedded) nothing happens because I have to call Show() for the form which contains the embedded form now.
I am lookin for a method to force showing the parent form when the Show() method of the embedded form is called. I could handle this by checking the existance of a parent form before calling Show() but I don't want to include this specific handling.
I would prefer to do this handling in the parent form wich gets notified when a form is docked.
The Show() method only sets the Visible property to true (RAD Studio Help), so I don't think that a message is fired ...?
Do you know a method to realize something like this?
Edit
I want to put some information about my application because I guess that it is more a designing problem than a programming problem.
The application uses several plugins to adapt to the connected hardware. The exe provides a drag&dock environment and contains a base class for dockable forms. The plugins don't have any knowledge about the docking implementation. By creating a dockable form and embedding a form from the plugin the plugin form becomes dockable. This is the reason why I want do get the parent form shown when somewhere the method Show() of the embedded form is called.
Show
doesn't do what you want. What you want to do requires something to walk the parent chain to find the top level form, and callShow
on that. You want the top level form shown but want to avoid walking the parent chain. Are you prepared for the possibility that what you are asking cannot be done? – David HeffernanGetParentForm <> nil
and simply show it). – kobik