Forum > Other

fpGUI set Align, then change Height plz?


I wanted to implement sort of expanding panel, when you have a thing panel at the top, then you click at it, then it becomes bigger, please see attached image
I use fpGUI
I have two panels, the first has Align = alTop, the second has Align = alClient;
Then I change the height of the upper panel form, say, 15 to 115 pixels // at runtime
If I read Height property, it shows what I assigned to it // I assigned 115 => it returns 115
But when I look at my window, it is no different, the visual height of the panel is not changing.
Why? This I don't know. Maybe the layout does not get realigned? Is this feature not implemented? Is this supposed to work like this?
I appreciate any information

P.S.: I expect picture 1 change to picture 2 after I assign Height property of upper panel, but I get picture 1 not changed instead

Fred vS:

I do not see your code, so difficult to answer.

But... fpGUI gives the wonderful UpdateWindowPosition feature.

 Maybe adding:
--- Code: ---Panel1.UpdateWindowPosition;
--- End code ---
after all your resize-move will do the trick...  ;)

Turned out: I actually had to call Realign method of _parent_ control (TfpgForm instance in my case) to make it work; calling only UpdateWindowPosition was not sufficient in my case
I noticed that Realign method calls UpdateWindowPosition method internally: Realign calls MoveAndResizeBy which calls MoveAndResize which in turn calls UpdateWindowPosition
It makes sense for me now


--- Quote from: hinst on March 10, 2014, 04:57:45 pm ---Turned out: I actually had to call Realign method of _parent_ control (TfpgForm instance in my case) to make it work;

--- End quote ---
Correct. If you used the Align property, then Realign must be called. If the Align property was not used, then UpdateWindowPosition is required to batch process positioning and size changes.

To explain the latter. fpGUI doesn't react immediately to Height, Top, Left, Width property changes. This is to minimise and optimise backend API calls. fpGUI batches those changes for you. The once you call UpdateWindowPosition for the specific widget, then all those changes get applied.


[0] Message Index

Go to full version