Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
wxSmith Feature request: Option to disable calls to Fit() and SetSizeHints()
oBFusCATed:
The major problem with wxSmith is that there is no button "regenerate all ui in the project/workspace", so it is hard to change such changes to the code-gen.
I'm pretty sure this would break things for existing users, but I'm not sure if it is a concern.
If we can generate more idiomatic wxwidgets code and it works as expected for new projects then I'm fine to change it.
The changes to the wxsmith code would be visible in the diffs, so people could review them and either fix them or report them.
The second point would require us to have a clear explanation why having Fit+Layout for panels is detrimental.
Do you have an example or link to documentation?
ollydbg:
--- Quote from: lesnewell on February 25, 2021, 07:21:17 pm ---My knowledge of the internals of wxSmith is pretty much zero but I'll take a look. I downloaded the CodeBlocks source but for some reason my built executable won't run. I get 'This application was unable to start correctly (0xc000007b)'. As far as I can figure out it appears to be a 32 bit/64 bit mixup somewhere but I have yet to figure out where.
--- End quote ---
Told us how you build the C::B(compiler, wx version and steps), I think we can help you to solve this issue.
lesnewell:
I dug into the code and added a 'Lay out the window' property to wxFrames and wxDialogs (maybe needs a more descriptive name). If this is checked only one SetSizeHints() or Layout() call is generated for the top level sizer. If it is not checked there is no SetSizeHints() or Layout().
wxPanels never have SetSizeHints() or Layout() because they cannot be top level windows.
--- Quote from: oBFusCATed on February 26, 2021, 02:36:27 pm ---I'm pretty sure this would break things for existing users, but I'm not sure if it is a concern.
--- End quote ---
As far as I am concerned, breaking existing projects is not acceptable. I'm testing on an existing project to make sure it doesn't. If 'Lay out the window' is enabled (the default) windows should behave pretty much the same as they do now. The generated code will change slightly when you open the wxs file but that often happens when a new feature is added to wxSmith.
--- Quote ---The second point would require us to have a clear explanation why having Fit+Layout for panels is detrimental.
Do you have an example or link to documentation?
--- End quote ---
wxSizer::SetSizeHints https://docs.wxwidgets.org/3.0/classwx_sizer.html#abc460cd0e2bb3bde72142fdb434bc546 lays out the window then fixes the window's minimum and maximum sizes based on the current layout. To quote the wxWidgets docs 'This only makes sense when window is actually a wxTopLevelWindow such as a wxFrame or a wxDialog'.
Currently SetSizeHints is called for every window containing a sizer. This effectively fixes the size of every window. While not recommended, this is not a problem until you change the contents of any child windows. Now when you call Layout() on the top level sizer it cannot resize child windows to fit their updated control layout.
Panels by definition are always child windows so should never use SetSizeHints.
lesnewell:
Here is a patch. I tested it on a pretty big project with about 60 windows managed by wxSmith. Some windows have layout disabled. The generated code all looks correct. I haven't tested every window in the application but every one I have tested so far looks as it should.
lesnewell:
--- Quote from: ollydbg on February 26, 2021, 03:42:27 pm ---Told us how you build the C::B(compiler, wx version and steps), I think we can help you to solve this issue.
--- End quote ---
I followed the instructions here http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Windows. I Installed the CodeBlocks 20.03 with MinGW package and used the recommended wx3.1.4 source. Using 64 bit build.
As I mentioned in a previous post the issue is that there are loads of copies of libstdc++-6.dll on my machine, both 32 bit and 64 bit. I have many open source applications installed and apparently many were built with MinGW. CodeBlocks even installs 3 copies.
I am currently getting around the problem by running CodeBlocks from a command prompt with PATH just set to point to MinGW and the wx dlls.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version