Recent

Author Topic: GroupBox height  (Read 8656 times)

asdf

  • Sr. Member
  • ****
  • Posts: 310
GroupBox height
« on: December 22, 2010, 09:25:36 am »
I would like to have each gap by value 8.
But the GroupBox1.Height was not enough.
How I can define the GroupBox1.Height by using this technique ?

procedure TForm1.FormCreate(Sender: TObject);
begin

edit1.AutoSize:=true;
edit2.AutoSize:=true;

groupbox1.Top:=8;
groupbox1.Left:=8;
groupbox1.Width:=edit1.Width+edit2.Width;
groupbox1.Height:=8+edit1.Height+8+edit2.Height+8;

edit1.Top:=8;
edit1.Left:=8;
edit2.Top:=edit1.Top+edit1.Height+8;
edit2.Left:=edit1.Left;

end;             
Lazarus 1.2.4 / Win 32 / THAILAND

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: GroupBox height
« Reply #1 on: December 22, 2010, 09:35:06 am »
Did you try FormShow event?

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: GroupBox height
« Reply #2 on: December 22, 2010, 09:42:39 am »
Never before.
Kindly help.

Or in only this case,
I need just to get the height of GroupBox1 with top margin (like) 8, gap between Edit1 and Edit 2 = 8 and bottom margin 8.
Lazarus 1.2.4 / Win 32 / THAILAND

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: GroupBox height
« Reply #3 on: December 22, 2010, 10:08:24 am »
GroupBox.Height <> GroupBox.ClientHeight

Child control's top coordinate is relative to GroupBox's client area, not to its absolute top.
This excludes GroupBox's border with caption, so you must make it bigger.
Size of the border depends on widget and theme settings.

Is Delphi this works differently, there child's top is relative to GroupBox's absolute top.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: GroupBox height
« Reply #4 on: December 22, 2010, 10:53:59 am »
In my project (with Qt), I use Edit1.Top:=0; in the same case and it seems good.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: GroupBox height
« Reply #5 on: December 22, 2010, 11:28:41 am »
GroupBox.Height <> GroupBox.ClientHeight

OMG!
Thank you so much ... Juha
Lazarus 1.2.4 / Win 32 / THAILAND

 

TinyPortal © 2005-2018