[DUG] Move/Paste Controls

Conor Boyd Conor.Boyd at trimble.co.nz
Mon Dec 4 08:30:25 NZDT 2006


The other thing to note with TBevel specifically is that it is not a
windowed control (it doesn't inherit from TWinControl), so it's never
going to "own" anything placed on it, and you can't place other
components "into" it.
 
Better off using a TPanel, with the borders set as desired, and then
when you drop/drag components on to it, they will be both owned and on
top of the TPanel.
 
Cheers,
 
C.

________________________________

From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Gary T. Benner


HI all 

At 15:25 on 2/12/2006 John wrote 

>One thing I have never found easy to do - if I have a form which has a 

>number of components on it, and later I decide to add either a bevel or
page 

>control to organise the layout better there is no easy way to move
existing 

>components into the page control/bevel - if dragged or cut/paste they 

>instead end up being behind it. 

> 

>There is an option to highlight the control and select "bring to front"
but 

>this doesn't seem to work consistently (eg it seemd to work for edit
control 

>and not labels and stupid things like that) - it doesn't seem to
actually 

>put it inside one or other tabsheet for instance which is the logical
thing 

>I would be wanting to do.... 

> 

>It can be done by editing the DFM, but is there an easier way? - as
that is 

>a tad fiddly and slow... 

It is important to understand the concept of a component's "parent". 

When you place a component such as a TButton on a form, the form becomes
it's "parent". This is a visual "containership". 

If you now place a TPanel on a form, the same thing happens, but when
you drop another TButton on the panel, the panel becomes it's parent,
not the form. 

In fact if you try and move the second button, it's visibility is
"contained" in the bounds of the panel. 

So the idea to "bring to front" or modify the "Z-order" is not really
relevant here. 

The easy way to handle your situation is to just cut and paste - ie cut
the component you want to move, and paste it into the component that can
contain other components( eg TPanel, TGroupBox, TPageControl etc ). For
instance, you cannot have a TButton contain other components. 

kind regards 

Gary 

PS: Don't get confused with a component's "owner" which is responsible
fo it's destruction.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20061204/83d7ec85/attachment.html


More information about the Delphi mailing list