Author Topic: Constraining button widths in wxSmith  (Read 3618 times)

Offline jeffg

  • Single posting newcomer
  • *
  • Posts: 7
Constraining button widths in wxSmith
« on: March 04, 2011, 02:42:07 pm »
I have a set of buttons in a wxStaticBoxSizer with orientation set vertical. Is there any way I can constrain the button widths to be equal to the largest one without explicitly setting widths in the properties? I feel that explicitly setting widths defeats the purpose of the sizers.

For example, I get this:


with the following:


I have tried a FlexGridSizer instead of the GridSizer and get the same result.

EDIT: Playing around some more, I found that checking the Expand property for each button had the desired effect. Can someone please confirm that this is the proper way to do it?

I also note from from reading the sticky again that this is not the correct place to ask How To questions, but it doesn't appear to say where the correct place is.  :(
« Last Edit: March 04, 2011, 03:22:43 pm by jeffg »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Constraining button widths in wxSmith
« Reply #1 on: March 04, 2011, 03:25:19 pm »
I have a set of buttons in a wxStaticBoxSizer with orientation set vertical.
You need to learn how to use wxWidgets sizers. There is a nice "sizer tutorial" here:
http://neume.sourceforge.net/sizerdemo/

What you need to do is to apply the "expand" flag properly to the items and (maybe) the container, depending on your setup. -> Search the above site for "Next is the wxEXPAND flag.".

Notice that this hardly related to the development of Code::Blocks, so this topic might get locked. An appropriate forum would e.g. be:
http://wxforum.shadonet.com/
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline jeffg

  • Single posting newcomer
  • *
  • Posts: 7
Re: Constraining button widths in wxSmith
« Reply #2 on: March 04, 2011, 04:12:21 pm »
Thank you. You will see from my edits that I discovered the expand property, and also was well aware that this was probably not the right place to ask, but there was no mention in the sticky (which I read carefully) where I should go instead. You've now answered that question.

I already looked through the wxSmith tutorials (because I only ask for help as a last resort if I can't work things out for myself), but the use of the expand property didn't stand out.