Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Layout management
Layout management [message #59610] |
Tue, 14 February 2023 20:08  |
zura
Messages: 2 Registered: February 2023
|
Junior Member |
|
|
Hello,
How do you manage layout in U++? Is there something like Qt's layout or wxWidgets sizer?
For instance, in wxWidgets, you can have e.g. a vertical sizer and widgets are laid out vertically. You can as well add widgets at runtime, dynamically. There are more complex sizers, such as wxGridSizer, for grid layout.
How can you achieve the same with U++?
Thanks!
|
|
|
Re: Layout management [message #59631 is a reply to message #59610] |
Sun, 19 February 2023 11:21   |
 |
mirek
Messages: 13894 Registered: November 2005
|
Ultimate Member |
|
|
zura wrote on Tue, 14 February 2023 20:08Hello,
How do you manage layout in U++? Is there something like Qt's layout or wxWidgets sizer?
For instance, in wxWidgets, you can have e.g. a vertical sizer and widgets are laid out vertically. You can as well add widgets at runtime, dynamically. There are more complex sizers, such as wxGridSizer, for grid layout.
How can you achieve the same with U++?
Thanks!
No sizers, layout designer.
https://www.ultimatepp.org/app$ide$LayoutDes_en-us.html
It can design resizable layouts too, so let us say it is just completely ortogonal approach to logical layouts. More RAD IMO, but you are free to disagree.
When we need to add widgets at runtime, various approaches are possible, but in 90% cases it leads to ArrayCtrl with a list of widgets (that would probably be very rough equivalent of wx grid).
Mirek
|
|
|
|
Re: Layout management [message #59641 is a reply to message #59640] |
Sun, 19 February 2023 18:53  |
 |
mirek
Messages: 13894 Registered: November 2005
|
Ultimate Member |
|
|
zura wrote on Sun, 19 February 2023 18:16Thanks for the clarification!
Another thing - is there some "auto fit/resize by content" mechanism? I.e. if the button has a label which is longer than button's width, how I can make the button resize to fit the label? Should I do it manually with absolute coords/sizes? (So first I have to calculate how many pixels the label takes on the button).
You do it manually. However, if you do that in designer, it rarely needs any adjustments (and if, then only for i18n) - layout coordinates are zoomed according to host GUI font, which rarely fails.
That said, widgets have standard virtual methods like GetMinSize that in theory could be use to do "sizers" style approach. In the past, it was discussed, but then ppl usually come to U++ because they like the programming with layouts.
|
|
|
Goto Forum:
Current Time: Mon Jun 05 08:40:45 CEST 2023
Total time taken to generate the page: 0.01267 seconds
|