Recent

Author Topic: fpGUI set Align, then change Height plz?  (Read 3291 times)

hinst

  • Sr. Member
  • ****
  • Posts: 303
fpGUI set Align, then change Height plz?
« on: March 09, 2014, 07:54:36 pm »
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
Too late to escape fate

Fred vS

  • Hero Member
  • *****
  • Posts: 1675
    • miXimum is the DJ's best friend
Re: fpGUI set Align, then change Height plz?
« Reply #1 on: March 09, 2014, 11:19:57 pm »
Hello.

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

But... fpGUI gives the wonderful UpdateWindowPosition feature.

 Maybe adding:
Code: [Select]
Panel1.UpdateWindowPosition;
Panel2.UpdateWindowPosition;
after all your resize-move will do the trick...  ;)
« Last Edit: March 09, 2014, 11:55:38 pm by Fred vS »
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

hinst

  • Sr. Member
  • ****
  • Posts: 303
Re: fpGUI set Align, then change Height plz?
« Reply #2 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; 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
Too late to escape fate

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI set Align, then change Height plz?
« Reply #3 on: March 12, 2014, 03:10:54 pm »
Turned out: I actually had to call Realign method of _parent_ control (TfpgForm instance in my case) to make it work;
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.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/