ramifications of not using sizers?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

ramifications of not using sizers?

Post by bsenftner » Fri Aug 07, 2020 4:44 pm

Over the last year, probably due to never having seen any document like the "What do these sizers things do?" ( http://neume.sourceforge.net/sizerdemo/ ) I have abandoned using sizers in any new windows/panels/dialogs I create in new code. I find the process of window/panel/dialog contents and controls layout trivial when I can just set a control's wxSize & wxPosition. I have a few dialogs and panels created over a year ago that use sizers, and modification of them is an extremely painful and time consuming process, as any control anywhere on the same window impacts the layout of all controls in that same window.

So, assuming I continue this practice of pre-figuring out a window's layout with "graph paper" (Viseo with grid lines) and then just handling a windows controls layout with a simple array of rectangles for widget placement... what problems could this method encounter?

I've tried my apps on various flavors of Windows, and Ubuntu systems with a huge range of monitor resolutions and DPI, and the layout is always what I've specified. So, what are the gotchas?

User avatar
doublemax
Moderator
Moderator
Posts: 15079
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: ramifications of not using sizers?

Post by doublemax » Fri Aug 07, 2020 5:32 pm

I've tried my apps on various flavors of Windows, and Ubuntu systems with a huge range of monitor resolutions and DPI, and the layout is always what I've specified.
I'm surprised by that. Usually everything is bigger under Linux. A layout that looks fine under Windows, should look compressed under Linux.

Also if you're under Window and the user selected a font scaling > 100%, your controls should be too small to contain the labels, e.g. of a button. Unless your application is not marked as "DPI aware" under Windows. In which case, it will run in some kind of emulation modus and the OS will upscale the window for you, making everything look blurry.
I have a few dialogs and panels created over a year ago that use sizers, and modification of them is an extremely painful and time consuming process, as any control anywhere on the same window impacts the layout of all controls in that same window.
That should be a good thing. Imagine you already have a complex layout and you need to add a button, and logically it has to be near the top. Don't you have to manually re-arrange all other controls then?`

Another issue could be multi-language support. I other languages text can be much longer. If your controls con't adjust themselves to their content, you'll either need individual layouts for all languages, or you need to make everything to big, that even the longest texts fit.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4368
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ramifications of not using sizers?

Post by ONEEYEMAN » Fri Aug 07, 2020 7:52 pm

@doublemax,
Except you should be familiar with the different languages and dialects, so that when the translation happens you will calculate everything properly according to the translation.
Also imagine working with different theming where fonts have different sizes.

Too complicated.

That's why "JAVA Sucks" don't work with absolute positioning/sizing.

Thank you.

User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

Re: ramifications of not using sizers?

Post by bsenftner » Fri Aug 07, 2020 9:55 pm

Doublemax,

Well, I just spent some time setting different monitor scale and font scale settings on a range of different systems, and I'm getting the layout I expect. But then again, I am extremely explicit in all my font usage. Every place I create a wxWindow or control it receives an application set font where I know and track every character's metrics. I started doing this so I could match my wxWidgets controls with text inside OpenGL rendered displays.

FWIW, the application is multi-lingual. I've been doing multi-lingual apps for decades. That's one of the reasons I want such precision of layout, so my pre-calculated adjustments for different languages and directions of text work as I expect (which I wrote a long time ago, before using wxWidgets.)

User avatar
doublemax
Moderator
Moderator
Posts: 15079
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: ramifications of not using sizers?

Post by doublemax » Fri Aug 07, 2020 11:40 pm

Well, you don't have to convince me. If you want to use absolute positioning instead of sizers, nobody is stopping you :)
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4368
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ramifications of not using sizers?

Post by ONEEYEMAN » Fri Aug 07, 2020 11:53 pm

Hi,
Besides all those magic of tracking everything yourself - this is precisely the reason you should do everything with the sizers.
They will do that for you - and more!

But like doublemax said - nobody stops you from that.

Thank you.

tuk1
Experienced Solver
Experienced Solver
Posts: 95
Joined: Sun Oct 08, 2017 9:36 am

Re: ramifications of not using sizers?

Post by tuk1 » Sat Aug 22, 2020 7:17 am

bsenftner wrote:
Fri Aug 07, 2020 4:44 pm
I have a few dialogs and panels created over a year ago that use sizers, and modification of them is an extremely painful and time consuming process, as any control anywhere on the same window impacts the layout of all controls in that same window.
Are you using some kind of wysiwyg when building your wx gui?

I find sizers to be a help rather than a hindrance and using them is the least of my wx worries, although I dont build my gui manually.
wxWidgets(v3.1.3) - Vs2019(v142) - Win10(x64) - DialogBlocks(v5.16.5_Unicode)

User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

Re: ramifications of not using sizers?

Post by bsenftner » Mon Sep 07, 2020 4:35 pm

I wish I used a GUI to create our apps' GUIs. The CTO I work for does not like them, and does not let his staff use them. :roll:
It would have saved weeks (accumulating to months) of dev time, but the CTO has had experiences where a GUI builder cannot do what is needed, and then the other auto-built interfaces can't be deciphered or translated, so an entire app then needs to be remade. So he does not allow tools that generate code, because when they fail the failure is colossal.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4368
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ramifications of not using sizers?

Post by ONEEYEMAN » Mon Sep 07, 2020 4:48 pm

Hi,
It looks like your CTO is "stupid". ;-)
There is a reason a company has developers - to write code.
There is a reason such developers have tools - to help them write this code.

RAD tools should not be final.
It should help the developers visualize what they see on the screen and then generate a "template", which can be modified as needed.

Thank you,

Post Reply