Recent

Author Topic: [ANSWERED] TPairSplitterSide cannot be resized in OnCreate  (Read 309 times)

CM630

  • Hero Member
  • *****
  • Posts: 1553
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
[ANSWERED] TPairSplitterSide cannot be resized in OnCreate
« on: November 12, 2025, 09:42:07 am »
I have never seen such behaviour before, so I wonder if it is correct.
In the attached sample I do:

Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.FormCreate(Sender: TObject);
  2. begin
  3.   Button1.Width := 300 ;
  4.   pssReceivedHex.Width := 600;
  5. end;

pssReceivedHex is a TPairSplitterSide .
After executing the code Button1 is resized, but pssReceivedHex is not .
I can resize it later from Form.OnShow and Button1OnClick, etc.


« Last Edit: November 18, 2025, 04:22:23 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

wp

  • Hero Member
  • *****
  • Posts: 13267
Re: TPairSplitterSide cannot be resized in OnCreate
« Reply #1 on: November 12, 2025, 11:49:05 am »
Not 100% sure, but I think the primary property to control the widths of the splitter sides is the PairSplitter's Position; the Width of the splitter sides maybe is not yet be available at this early stage (the bottom pssReceived PairSplitter is client-aligned inside the pssBottom side of the psVertical PairSplitter; AFAIK the related size calculations are not yet performed in the OnCreate event). Therefore, I changed PairSplitter.Position, and this is working as expected:
Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.FormCreate(Sender: TObject);
  2. begin
  3.   Button1.Width := 300 ;
  4.   pssReceived.Position := 600;
  5. //  pssReceivedHex.Width := 600;
  6.   //ShowMessage ('OnCreate');
  7. end;
« Last Edit: November 12, 2025, 12:08:29 pm by wp »

CM630

  • Hero Member
  • *****
  • Posts: 1553
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: TPairSplitterSide cannot be resized in OnCreate
« Reply #2 on: November 12, 2025, 02:52:37 pm »
...
PairSplitter.Position, and this is working as expected:
...
I will try it this way.
Indeed, it occurs that in the code below, nothing happens when Button2 is clicked.
pssReceivedHex is on the left side of the separator, pssReceivedText is on the right.
So it seems that the left/top height/width of the TpairSplitter is (almost) the same as TPairSplitter.Position.

Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.Button1Click(Sender: TObject);
  2. begin
  3.     pssReceivedHex.Width := 600 ;
  4. end;
  5.  
  6. procedure TfrmMain.Button2Click(Sender: TObject);
  7. begin
  8.     pssReceivedText.Width := 333 ;
  9. end;
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018