Author Topic: wxSmith Feature request: Option to disable calls to Fit() and SetSizeHints()  (Read 4486 times)

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
1. Descriptive commit message. I can gather one from the topic, but I'd be happier if you can provide one.
Changes to wxSmith code generation:
Stop SetSizeHints() being used for every window containing a sizer and make laying out the window optional.
Quote
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.
Les Newell
Quote
3. A description for the tooltip for the "Lay out the window" property.
Automatically lay out the window. If disabled you must call Layout(), Fit() or SetSizeHints() in your code.

Quote
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. ;)
Yeah, copy and paste isn't always your friend. The last patch fixes this. If you changed it yourself, please use the name 'layout_window' so it doesn't break a project I'm already using this on.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13393
    • Travis build status
Your explanations are too brief for my liking. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Ok,  how about this for the commit message
Changes to wxSmith code generation:
Stop SetSizeHints() being used for every window containing a sizer. The wxWidgets documentation recommends SetSizeHints to only be used on top level windows https://docs.wxwidgets.org/3.0/classwx_sizer.html#abc460cd0e2bb3bde72142fdb434bc546
Added 'Lay out window' option for top level windows. If enabled (the default) the wxWidgets layout sytem is called and the window size is set using SetSizeHints(), Fit() or Layout() as appropriate. If disabled no calls are made to the layout system, allowing extra controls to be added/removed outside of wxSmith managed code. Note: after adding,removing or hiding controls you need to call SetSizeHints, Fit() or Layout().

I'm not sure if the tool tip should be much longer. IMHO tool tips should be fairly short. It's likely that this function is only of much use to people who have a reasonable understanding of how windows are laid out. In that case the tip is probably enough as it is.

By the way are you adding tips for all of the other options?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13393
    • Travis build status
Thanks this is a lot better.

The changes I plan to commit are in this branch: https://github.com/obfuscated/codeblocks_sf/tree/wxsmith/layout
Please test and verify I'm not missing something.

I have no time or knowledge to add tooltips for all properties, but this is a start to show how it is done.
Patches welcome. Ideally we should add for all of them.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
I just looked at the code, built and tested it. Everything looks as I would expect. Thanks.

Quote
I have no time or knowledge to add tooltips for all properties, but this is a start to show how it is done.
Patches welcome. Ideally we should add for all of them.
Yes, that's quite a bit of work. That's why I wan't to keen on adding tool tips.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13393
    • Travis build status
I'll be happy if someone more familiar with wxsmith usage and wxwidgets could provide tooltips for the more often used classes.
The properties related to expand/shape/properties and similar are really confusing and are worth documenting.
Same for the minimal/max/default sizes.
Could you do it now that we have a way to do it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
To be honest I'm pretty tied up at the moment. I'm already working flat out on a number of projects for various customers.