dev.emsdn.com

Join About
Home SITEMAP Most Recent

Delphi

Home »» Delphi [Programming]
Thread Profile: Locking to Tpanel. Was: Protecting Tedit Field.


Locking to Tpanel. Was: Protecting Tedit Field.

Hi Eddie,
That brings up an interesting question.
If I design the form and place a Tpanel or Group Box, and then place Tedit
and Tlabel objects on the Group box they stay on top and get dragged around
with the Tpanel or Group Box to whereever I place it on the form.
But if I put down a group box later, because I've decided I'd like to
organize a number of fields, I can send the Group Box or Tpanel to the back
but the Tlabels stay covered and the Tedit does go on top but they don't
belong to the Group Box. Dragging the Group box to another spot on the form
leaves the fields behind.
How do I change the Tedit and Tlabel objects so they 'belong' to the group
box?
Thanks,
John Dammeyer
Eddie Shipman wrote:
Set it on a TPanel the same size and set the Panel's enabled to False.
Delphi mailing list -Delphi (AT) elists (DOT) org


total 6 Comments Similar Thread
  • 6Answer
  • Total

at [2008-5-4 19:24:46]


You need to change the parent. 2 ways - cut and paste onto the groupbox, or
edit the DFM file in text format, moving them inside the groupbox.

Hi Eddie,

That brings up an interesting question.

If I design the form and place a Tpanel or Group Box, and then place Tedit
and Tlabel objects on the Group box they stay on top and get dragged around
with the Tpanel or Group Box to whereever I place it on the form.

But if I put down a group box later, because I've decided I'd like to
organize a number of fields, I can send the Group Box or Tpanel to the back
but the Tlabels stay covered and the Tedit does go on top but they don't
belong to the Group Box. Dragging the Group box to another spot on the form
leaves the fields behind.

How do I change the Tedit and Tlabel objects so they 'belong' to the group
box?

Thanks,

John Dammeyer

Eddie Shipman wrote:

Set it on a TPanel the same size and set the Panel's enabled to False.

Delphi mailing list -Delphi (AT) elists (DOT) org

Delphi mailing list -Delphi (AT) elists (DOT) org


  • 1No.

at [2008-5-4 19:25:46]


Select the components holding the Ctrl key down. Press Ctrl+X (Cut).
Click on the Panel or GroupBox and press Ctrl+V (Paste).

Ross.

Message
From: "John Dammeyer" <johnd (AT) autoartisans (DOT) com>
To: "'Borland's Delphi Discussion List'" <delphi (AT) elists (DOT) org>
Sent: Saturday, December 17, 2005 6:06 AM
Subject: Locking to Tpanel. Was: Protecting Tedit Field.

Hi Eddie,

That brings up an interesting question.

If I design the form and place a Tpanel or Group Box, and then place
Tedit
and Tlabel objects on the Group box they stay on top and get dragged
around
with the Tpanel or Group Box to whereever I place it on the form.

But if I put down a group box later, because I've decided I'd like to
organize a number of fields, I can send the Group Box or Tpanel to the
back
but the Tlabels stay covered and the Tedit does go on top but they don't
belong to the Group Box. Dragging the Group box to another spot on the
form
leaves the fields behind.

How do I change the Tedit and Tlabel objects so they 'belong' to the
group
box?

Thanks,

John Dammeyer

Delphi mailing list -Delphi (AT) elists (DOT) org


  • 2No.

at [2008-5-4 19:26:48]


John Dammeyer wrote:

Hi Eddie,

That brings up an interesting question.

If I design the form and place a Tpanel or Group Box, and then place Tedit
and Tlabel objects on the Group box they stay on top and get dragged around
with the Tpanel or Group Box to whereever I place it on the form.

But if I put down a group box later, because I've decided I'd like to
organize a number of fields, I can send the Group Box or Tpanel to the back
but the Tlabels stay covered and the Tedit does go on top but they don't
belong to the Group Box. Dragging the Group box to another spot on the form
leaves the fields behind.

How do I change the Tedit and Tlabel objects so they 'belong' to the group
box?

The issue is Window parentage, this determines which window is
responsible for displaying any "contained" controls (called its
"Children" or "Child Controls").

In order for the GroupBox to know it's supposed to serve as the
Parent for these controls, they have to be inserted into the
GroupBox in the form designer.

If you already have controls that you want to keep, the simplest
thing to do is:

1. Select the controls in question.
2. Cut them to the clipboard.
3. Select the parent control (in your case the GroupBox).
4. Paste the controls back in.

HTH

Stephen Posey
slposey (AT) concentric (DOT) net

Delphi mailing list -Delphi (AT) elists (DOT) org


  • 3No.

at [2008-5-4 19:27:53]


John Dammeyer wrote:
>
>How do I change the Tedit and Tlabel objects so they 'belong' to the
>group
>box?
>

The issue is Window parentage, this determines which window is responsible
for displaying any "contained" controls (called its "Children" or "Child
Controls").

In order for the GroupBox to know it's supposed to serve as the Parent for
these controls, they have to be inserted into the GroupBox in the form
designer.

If you already have controls that you want to keep, the simplest thing to
do is:

1. Select the controls in question.
2. Cut them to the clipboard.
3. Select the parent control (in your case the GroupBox).
4. Paste the controls back in.

HTH

Stephen Posey
slposey (AT) concentric (DOT) net

Another (perhaps easier) solution is to move the control under the desired
parent in the TreeView. Simply drag the WhateverBtn to PanelX (for
example). You don't have to move anything in the form; Delphi will adjust
Top and Left to reflect the new position relative to the new parent object.
And the object will take its proper alphabetical place under the new parent.

Rainer

Delphi mailing list -Delphi (AT) elists (DOT) org


  • 4No.

at [2008-5-4 19:28:52]


Rainer von Saleski wrote:
>>John Dammeyer wrote:
>>
>>

How do I change the Tedit and Tlabel objects so they 'belong' to the
group
box?
>>
>>The issue is Window parentage, this determines which window is responsible
>>for displaying any "contained" controls (called its "Children" or "Child
>>Controls").
>>
>>In order for the GroupBox to know it's supposed to serve as the Parent for
>>these controls, they have to be inserted into the GroupBox in the form
>>designer.
>>
>>If you already have controls that you want to keep, the simplest thing to
>>do is:
>>
>>1. Select the controls in question.
>>2. Cut them to the clipboard.
>>3. Select the parent control (in your case the GroupBox).
>>4. Paste the controls back in.
>>
>>HTH
>>
>>Stephen Posey
>>slposey (AT) concentric (DOT) net
>>


Another (perhaps easier) solution is to move the control under the desired
parent in the TreeView. Simply drag the WhateverBtn to PanelX (for
example). You don't have to move anything in the form; Delphi will adjust
Top and Left to reflect the new position relative to the new parent object.
And the object will take its proper alphabetical place under the new parent.

The Treeview, eh?

You know, I hardly ever look at that Window, as I rarely saw the
need. And I didn't know it would do what you describe.

Thanks for the tip!

Stephen Posey
slposey (AT) concentric (DOT) net

Delphi mailing list -Delphi (AT) elists (DOT) org


  • 5No.

at [2008-5-4 19:29:46]


John Dammeyer wrote:
Does Treeview exist in Delphi 5? Can't seem to find anything like
that.
No, it doesn't. To change a control's parentage, you'll have to either cut
and paste, or edit the DFM file directly.


  • 6No.