Button FX: Resizing/Activating/Relabeling
Vadim Zeitlin
vadim at wxwidgets.org
Wed Jan 9 09:26:10 PST 2008
On Wed, 9 Jan 2008 17:48:53 +0100 Martin Braun <braun at int.uni-karlsruhe.de> wrote:
MB> I'd like to create a button the same (dynamic) size as the BoxSizer it's in.
MB> Trouble is, my buttons are always the same size. I've tried using wx.EXPAND
MB> like this (note I'm using wxPython):
MB>
MB> hbox.Add(self.button_tl, 0, wx.EXPAND)
You need to set proportion to 1 or the button will only extend in the
direction orthogonal to the sizer main direction.
MB> didn't work. I tried grabbing the size from the hbox and explicitly setting
MB> it, didn't work either:
MB>
MB> self.button_tl.SetSize(hbox.GetSize())
You shouldn't mix manual size setting calls and sizers. Use either one or
the other but not both.
MB> The other problem I have, when the button is clicked, I want it to have a
MB> different label. Trouble is, when I use SetLabel(), it also changes the state
MB> of the button, so now my button always appears un-press (although it changes
MB> it's label). Is there a way of explicitly telling a button to looked pressed?
Use wxToggleButton.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list