Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GridPanel does not adjust at first resize

I have a problem I am unable to solve even though I spend long time trying to do it.

I usually use GridPanels to align controls on forms. It has, however, an annoying bug. When the GridPanel align mode is alClient and I maximize its parent window, the GridPanel adjusts to the new size of that window, however, the controls laying on the grid do not. They stay in the same position they were before window resize. It happens only at the first window's maximization. If the window is first resized manually, everyting is OK. I think the grid adjusts its child controls after the second resize event (??).

What to to do make GridPanel work properly if it comes to this bug? It might be enough to send a message to it (but what message?), I do not know. I tried to use Realign, Refresh etc., but they did not help.

Thanks for your help in advance,

Mariusz.

like image 537
Mariusz Schimke Avatar asked May 14 '09 08:05

Mariusz Schimke


2 Answers

Ah, I've had similar issues as well. It might be related to a resizing problem in the VCL. You might want to try the fix by Andreas Hausladen. It seems to work for me in most of the cases.

like image 125
onnodb Avatar answered Sep 21 '22 05:09

onnodb


Changing the width / invalidating the control doesn't work for me (something changed with recent versions of RAD Studio?).

Anyway a similar, simple workaround along that line is:

procedure TForm1.FormResize(Sender: TObject);
begin
  GridPanel1.ControlCollection.BeginUpdate;
  GridPanel1.ControlCollection.EndUpdate;
end; 
like image 24
manlio Avatar answered Sep 20 '22 05:09

manlio