Re: Delphi BringToFront / SendToBack


[ DelphiLand FAQ ]

Posted by webmaster Guido on September 06, 2004 at 20:09:21:

In Reply to: Re: Bing to front/Send to back posted by Giovanni Caramia on September 05, 2004 at 09:55:43:

: Sorry. I forgot that BringToFront and SendToBack are properties of visual components ......
-----------

Well, not exactly "properties", but "methods". You can call BringToFront and SendToBack to change the stacking order of overlapping visual components, the order in which they appear on top of each other. This so-called Z order depends initially on the order the controls were placed on the form. For example, if you put an image on a form, and on top of that you put a label, the image appears "on the bottom". Call the SendToBack method for the label to move it below the image, or call the BringToFront method of the image. In code:

Label1.SendToBack; // use this...
Image1.BringToFront; // ...or this

Label and image are both non-windowed controls. The ordering of two windowed controls is the same as that of two non-windowed controls. For example, if you put a memo on a form, and next you put a checkbox on top of it, the checkbox remains on top. Calling SendToBack for the checkbox makes the memo appear on top.

Note: windowed controls always stay on top of non-windowed controls. If you put a memo on a form, and next put a label on top of the memo, the label disappears behind the memo. Thus, the following line of code has no effect, the label remains behind the memo:

Label1.BringToFront; // does nothing




Related Articles and Replies


[ Delphi Forum -- by DelphiLand ]