Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Layout management
Layout management [message #59610] Tue, 14 February 2023 20:08 Go to next message
zura is currently offline  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 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
zura wrote on Tue, 14 February 2023 20:08
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!


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 #59640 is a reply to message #59631] Sun, 19 February 2023 18:16 Go to previous messageGo to next message
zura is currently offline  zura
Messages: 2
Registered: February 2023
Junior Member
Thanks 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).
Re: Layout management [message #59641 is a reply to message #59640] Sun, 19 February 2023 18:53 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
zura wrote on Sun, 19 February 2023 18:16
Thanks 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.
Previous Topic: Multiwindows
Next Topic: LabelBox align problem
Goto Forum:
  


Current Time: Wed Apr 24 22:43:33 CEST 2024

Total time taken to generate the page: 0.02136 seconds