Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detach a panel and show it in a separate window?

Tags:

delphi

vcl

Let's say I have form A that contains a panel (with many other controls in it) and a form B that it is empty.
Can I programmatically detach the panel from form A and move it in form B (and maybe back to form A)?

I know that I can change the Owner of the panel but does it work between different forms?

Update:
After some Googling I see that there is a ParentWindow property.

like image 802
Server Overflow Avatar asked Jun 23 '11 23:06

Server Overflow


1 Answers

As noted by others, there are several problems with changing the parent window of a control without changing the ownership, and changing a controls owner can be difficult if it has multiple controls sitting on it...

One way around it is to use a frame instead. A frame owns all of it's sub-controls, so all you would need to do is change the owner and parent of the frame, and everything else will come along with it. This approach also allows you to keep all the event handlers and glue code in a single place as well.

N@

like image 173
Nat Avatar answered Nov 15 '22 04:11

Nat