Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
wxSmith Feature request: Option to disable calls to Fit() and SetSizeHints()
oBFusCATed:
Ah it seems you're not using flTopLevel, so the property is never visible...
oBFusCATed:
And my simple change to add tooltips works fine. :)
So I'll need a good explanation what this property does before pushing this fix.
lesnewell:
--- Quote from: oBFusCATed on March 02, 2021, 09:54:08 pm ---Ah it seems you're not using flTopLevel, so the property is never visible...
--- End quote ---
Huh. I just checked the patch and it looks like I messed up somewhere. There are some files missing from the patch. That explains why the property was missing from your frame.
I'll have another go tomorrow.
--- Quote ---If I use the code generated by the patched cb the min size of the window is not set, so I can shrink it smaller then the content.
I have "Default min size" checked.
--- End quote ---
SetSizeHints should automatically set min and max sizes. Is SetSizeHints being called?
lesnewell:
--- Quote ---If I use the code generated by the patched cb the min size of the window is not set, so I can shrink it smaller then the content.
--- End quote ---
I just tested a frame and with 'Lay out the window' turned off you can resize the frame to any size you want. With it on (the default) you can't resize below the minimum size that fits all controls. That is the expected behaviour.
--- Quote ---I have "Default min size" checked.
I'm always confused by this min size stuff, so I don't know if this is a regression or not but it is a change in behaviour.
--- End quote ---
Size sets the initial size of the window, overriding the layout system.
Min size sets the minimum size of the window. This will override the layout system if the layout could be smaller.
Max size sets the maximum size of the window. This will override the layout system if the layout should be bigger.
Manually setting these sizes is really not a good idea in most cases. SetSizeHints sets these automatically, based on the ideal minimum and maximum sizes reported by the layout system.
I just ran some tests and noticed a bug that has been around for a very long time. As SetSizeHints was called for every sizer, it overrode whatever sizes you entered. This probably explains why you found them confusing. They actually did nothing. I've also been caught out by this a few times.
With the attached patch, size, min size and max size should work correctly. For top level windows with 'Lay out window' selected it gets a little complicated.
* If size, min and max are set to default, SetSizeHints() is used. The layout system is free to decide the optimum window layout and sizes.
* If size is default but min and/or max are not, Fit() is used. This sets size to the optimum decided by the layout system while still obeying min and max size. Depending on min/max size the layout may not fit.
* If size is not default Layout() is used. This makes the layout system try to fit to your defined size. The layout probably will not fit.
The attached patch has these changes:
* The above changes depending on what defaults are used
* The missing files
* Fixed 'Lay out the window' selection not being saved correctly.
* Fixed SetSizer() sometimes being called twice on top level windows
oBFusCATed:
Thanks, it seems to work.
Now I need a couple of things to finish this of:
1. Descriptive commit message. I can gather one from the topic, but I'd be happier if you can provide one.
2. A real name or nickname. I like to give credit to people who provide patches and svn doesn't allow separation between author and committer name, so I write it down in the commit message.
3. A description for the tooltip for the "Lay out the window" property.
Just a note: You've messed up the load/save of the layout property, but I've fixed it. Re using parent_arg wasn't a good idea. ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version