sizer in MFC is quite clever

This forum is reserved for everything you want to talk about. It could be about programming, opinions, open source programs, development in general, or just cool stuff to share!
Post Reply
Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

sizer in MFC is quite clever

Post by Ronald » Mon Mar 15, 2021 2:08 am

  • To auto position (i.e. left top) a child window
    • Moving Type: Both / Horizontal / Vertical
    • Moving X: percentage to move horizontally when the parent is resized
    • Moving Y: percentage to move vertically when the parent is resized
  • To auto resize (i.e. left top) a child window
    • Sizing Type: Both / Horizontal / Vertical
    • Sizing X: percentage to resize horizontally when the parent is resized
    • Sizing Y: percentage to resize vertically when the parent is resized

It's simple and powerful, no nested sizers required.

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

Re: sizer in MFC is quite clever

Post by ONEEYEMAN » Tue Mar 16, 2021 2:35 pm

Hi,
Are you stating the fact or asking the question?
Also - what does MFC has to do with wxWidgets/sizers?

Thank you.

Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

Re: sizer in MFC is quite clever

Post by Ronald » Wed Mar 17, 2021 7:01 am

ONEEYEMAN wrote:
Tue Mar 16, 2021 2:35 pm
Are you stating the fact or asking the question?
stating a fact
ONEEYEMAN wrote:
Tue Mar 16, 2021 2:35 pm
Also - what does MFC has to do with wxWidgets/sizers?
As I can see, MFC's sizer is simpler and more flexible than wxWidgets' sizer.
But I'm not sure, so for open discussion.
If MFC's sizer is totally better than wxWidgets' sizer, I think it's very easy for wxWdigets to adopt it.

utelle
Moderator
Moderator
Posts: 1018
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: sizer in MFC is quite clever

Post by utelle » Wed Mar 17, 2021 7:47 am

Ronald wrote:
Wed Mar 17, 2021 7:01 am
ONEEYEMAN wrote:
Tue Mar 16, 2021 2:35 pm
Are you stating the fact or asking the question?
stating a fact
Is it? Really? For a simple UI one might get this impression, but resizing the parent window is not the only use case where sizers can play an important role. For example, if you want a button or label to adjust to a different text length in an i18n application, you will soon experience the limitations of MFC. The sizers in wxWidgets give you full control over such issues.
Ronald wrote:
Wed Mar 17, 2021 7:01 am
As I can see, MFC's sizer is simpler and more flexible than wxWidgets' sizer.
But I'm not sure, so for open discussion.
This may be true only for the simplest use cases. For complex UI layouts you are much better off with the sizer concept of wxWidgets. wxWidgets' sizers can cope easily with different text lengths or different font sizes. AFAICT that is a nightmare in MFC.
Ronald wrote:
Wed Mar 17, 2021 7:01 am
If MFC's sizer is totally better than wxWidgets' sizer, I think it's very easy for wxWdigets to adopt it.
You are free to implement an MFC-like layout mechanism for wxWidgets, of course. However, IMHO your time would be invested better to learn the principles of wxWidgets' sizers to their full extent.

Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

Re: sizer in MFC is quite clever

Post by Ronald » Wed Mar 17, 2021 11:01 am

utelle wrote:
Wed Mar 17, 2021 7:47 am
For example, if you want a button or label to adjust to a different text length in an i18n application, you will soon experience the limitations of MFC. The sizers in wxWidgets give you full control over such issues.
Yes, with MFC's sizer, the position & size of a control are only adjusted according to size of the parent.
So it is not totally better than wxWidgets.

However, I think if both types of sizers are avaiable and well cooperates with each other, it'll be a nice feature for who that build the UI programmatically.

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

Re: sizer in MFC is quite clever

Post by ONEEYEMAN » Wed Mar 17, 2021 3:15 pm

Hi,
Why do you think that?
Is there a reason you are not satisfied with wxWidgets layout scheme?

Thank you.

Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

Re: sizer in MFC is quite clever

Post by Ronald » Thu Mar 18, 2021 3:28 am

ONEEYEMAN wrote:
Wed Mar 17, 2021 3:15 pm
Why do you think that?
Is there a reason you are not satisfied with wxWidgets layout scheme?
When building UI with codes manually, sometimes nested sizers become a little deeper.
It's not a big deal, but I think for most cases a simpler sizer is enough and more human friendly.

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

Re: sizer in MFC is quite clever

Post by ONEEYEMAN » Thu Mar 18, 2021 5:38 am

Hi,
So what is the problem?
Either don't do it manually, or simplify the design.

I think what you are proposing is purely aestetic and will not be put in the library.

Thank you.

Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

Re: sizer in MFC is quite clever

Post by Ronald » Thu Mar 18, 2021 11:27 am

ONEEYEMAN wrote:
Thu Mar 18, 2021 5:38 am
Hi,
So what is the problem?
Either don't do it manually, or simplify the design.
I'm glad to see it in wxWidgets.
ONEEYEMAN wrote:
Thu Mar 18, 2021 5:38 am
I think what you are proposing is purely aestetic and will not be put in the library.
Also more human/programmer friendly.

I also think it will not be put in the lib.

Kvaz1r
Super wx Problem Solver
Super wx Problem Solver
Posts: 300
Joined: Tue Jun 07, 2016 1:07 pm

Re: sizer in MFC is quite clever

Post by Kvaz1r » Thu Mar 18, 2021 12:02 pm

I'm familiar with such layout system, but for me it's not so convenient as automatic sizers in wxWidgets and at least wxBoxSizer is as simple as it could be.

Ronald
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 241
Joined: Mon Mar 05, 2018 4:17 am

Re: sizer in MFC is quite clever

Post by Ronald » Thu Mar 18, 2021 2:50 pm

Kvaz1r wrote:
Thu Mar 18, 2021 12:02 pm
I'm familiar with such layout system, but for me it's not so convenient as automatic sizers in wxWidgets and at least wxBoxSizer is as simple as it could be.
MFC's layout system depends on the initial layout, wx's doesn't depends on the initial layout, in this case wx wins.

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

Re: sizer in MFC is quite clever

Post by ONEEYEMAN » Thu Mar 18, 2021 3:12 pm

Hi,
Because MFC use (or used) the native Win32 API, where there only static positioning and sizes.
There is no sizers (or any other layout system) there.

You just D&D the control on the form, then resize it and have a static form which can't be changed easily.

wx sizers system is much more flexible.
(It's even better than "JAVASucks").

Thank you.

Post Reply