If aligned inside container, internal height doesn't change lazarus / 31-LCL ---------------------------------------------------------------------- bdexterholland · 2018-01-12 21:17 i have a situation that combines TPanel & TSpeedButtons. If I drop TSpeedButtons inside TPanel and use this code to resize TSpeedButton, why not TSpeedbutton changes internal's height since it visuality it will be different? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TPanel.BorderWidth: = 10;  TPanel.Height := 50;  TSpeedButton.Align := Alright;  TSpeedButton.Width := TSpeedButton.Height; This behavior repeats with TButton and TBitbtn ---------------------------------------------------------------------- ASerge · 2018-01-12 21:32 Quote from: bdexterholland on January 12, 2018, 10:17:03 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TPanel.BorderWidth: = 10;  TPanel.Height := 50;  TSpeedButton.Align := Alright;  TSpeedButton.Width := TSpeedButton.Height;Executed as expected - SpeedButton is located over the entire height of the Panel, taking into account, of course, Panel.BorderWidth. ---------------------------------------------------------------------- howardpc · 2018-01-12 21:40 ?? That code does not even compile, using type names (TPanel) instead of instance names (Panel1 or whatever). ---------------------------------------------------------------------- bdexterholland · 2018-01-12 21:42 Quote from: howardpc on January 12, 2018, 10:40:24 pm?? That code does not even compile, using type names (TPanel) instead of instance names (Panel1 or whatever). I Know man, that`s not the point.... ---------------------------------------------------------------------- bdexterholland · 2018-01-12 21:45 Quote from: ASerge on January 12, 2018, 10:32:54 pmExecuted as expected - SpeedButton is located over the entire height of the Panel, taking into account, of course, Panel.BorderWidth. I'm not sure if i got what you said. Think about TSpeedbutton.Parent = TPanel. In this case, Tpanel.ClientHeight = 30 and, by some reason, you set in object inspector TSpeedButton.Height = 50 and align it to alRight (even alLeft) inside TPanel, should not TSpeedButton.Height be changed to 30 by new align? ---------------------------------------------------------------------- ASerge · 2018-01-12 21:56 Quote from: bdexterholland on January 12, 2018, 10:45:53 pmshould not TSpeedButton.Height be changed to 30 by new align? So it is, more precisely become 28, taking into account Panel.BevelWidth. ---------------------------------------------------------------------- howardpc · 2018-01-12 22:10 I think you may be best to do this in two stages, since setting Align does not directly set Height (LCL bounds setting may be deferred). In a new Lazarus project drop a panel on the main form, and complete it as follows. Does this give the general effect you want? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Forms, sysutils, Controls, ExtCtrls, Buttons; const  Speed_Button_Count = 5; // set to desired value type   TForm1 = class(TForm)    Panel1: TPanel;    procedure FormCreate(Sender: TObject);    procedure FormShow(Sender: TObject);  private    sbArray: array of TSpeedButton;    procedure CreateButtons(aButtonCount: Integer; aPanelParent: TPanel);    procedure SpeedbuttonClick(Sender: TObject);  end; var  Form1: TForm1; implementation {$R *.lfm} procedure TForm1.CreateButtons(aButtonCount: Integer; aPanelParent: TPanel);var  i: Integer;begin  SetLength(sbArray, aButtonCount);  for i := 0 to aButtonCount-1 do begin    sbArray[i]:=TSpeedButton.Create(aPanelParent);    with sbArray[i] do begin      Caption:=IntToStr(i+1);      Name:='SpeedButton' + IntToStr(i+1);      Align:=alRight;      BorderSpacing.Around:=5;    OnClick:=@SpeedbuttonClick;      Parent:=aPanelParent;    end;  end;end; procedure TForm1.FormCreate(Sender: TObject);begin  Panel1.BorderWidth := 5;  Panel1.Height := 55;  Panel1.Caption:='';  CreateButtons(Speed_Button_Count, Panel1);end; procedure TForm1.FormShow(Sender: TObject);var  sb: TSpeedButton;begin  for sb in sbArray do    sb.Width:=sb.Height;  Panel1.Width:=Speed_Button_Count*(sb.Height + 5) + 15;end; procedure TForm1.SpeedbuttonClick(Sender: TObject);begin  Caption:=Format('You clicked %s',[(Sender as TSpeedButton).Name]);end; end.