Page 1 of 1

sizer in MFC is quite clever

Posted: Mon Mar 15, 2021 2:08 am
by Ronald
  • 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.

Re: sizer in MFC is quite clever

Posted: Tue Mar 16, 2021 2:35 pm
by ONEEYEMAN
Hi,
Are you stating the fact or asking the question?
Also - what does MFC has to do with wxWidgets/sizers?

Thank you.

Re: sizer in MFC is quite clever

Posted: Wed Mar 17, 2021 7:01 am
by Ronald
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.

Re: sizer in MFC is quite clever

Posted: Wed Mar 17, 2021 7:47 am
by utelle
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.

Re: sizer in MFC is quite clever

Posted: Wed Mar 17, 2021 11:01 am
by Ronald
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.

Re: sizer in MFC is quite clever

Posted: Wed Mar 17, 2021 3:15 pm
by ONEEYEMAN
Hi,
Why do you think that?
Is there a reason you are not satisfied with wxWidgets layout scheme?

Thank you.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 3:28 am
by Ronald
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.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 5:38 am
by ONEEYEMAN
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.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 11:27 am
by Ronald
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.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 12:02 pm
by Kvaz1r
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.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 2:50 pm
by Ronald
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.

Re: sizer in MFC is quite clever

Posted: Thu Mar 18, 2021 3:12 pm
by ONEEYEMAN
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.