> From: Robin Dunn <[hidden email]>
> To: [hidden email]; [hidden email] > Subject: Re: button.py -- Great!!
> Date: December 13, 1999 5:45 PM
> > I have some suggestions before you put it into production (sorry about
> > messing with your code):
> > 1) Add some button active colour so the button is lighter in the
> > state using wxSYS_COLOUR_3DLIGHT
> Yep. I had thought too of that but hadn't gotten to it yet. I'd also
> to figure out a way to recalulate this color as well as the shadow and
> highlight edge colors if the programmer changes the background color.
> example if I call SetBackgroundColour(wxBLUE) then currently the extra
> stay the same as the system defaults.
I tried to set the background colour to blue with
SetBackgroundColour(wxBLUE) but it had no effect. I guess upFaceClr and
downFaceClr need to be modified.
> > 2) Currently the default size of the wxGenButton is different from the
> > wxButton, both in height and width. If you supply text that is too
> > it spills out of the button. It would be nice if the default size
> > the same and expand to allow for the length of the text. How do they
> > calculate default size for a normal wxButton?
> Already done in my working copy. The one issue remaining is that the
> size is calculated in the __init__ method but the programmer may change
> size of the bezel later with SetBezelWidth, which can make the default
> really stupid looking...
I think with the larger button default size a bezel of say 2 to 5 pixels
will look ok. If a person really wants something more then they can set
the size. Therefore I would not worry about it.
> > And a question: When you use SetUseFocusIndicator(FALSE) it removes
> > focus indicator but it still accepts a focus. Therefore the button
> > change if a key hit. Is there a way so the button will not have any
> > at all. Therefore, when you hit the tab key it will by-pass the button
> > altogether?
> Use the wxWindow.Enable method. The button classes check IsEnabled()
> doing anything, and the wxDialog and wxPanel check it before tabing to
I thought Enable was for enabling and disabling the button totally and not
just the focus part.
I have another request. Can we attach the button object to the event in
the Notify method
so in the button event handler we can find which button in a group was
modified. One button event handler would then be used for a group of
radio/check/regular buttons. My button event would look like:
def myEvent(self, event):
change= ('Button now up ', 'Button now down ')
print change[event.isDown], event.buttonObject.GetLabel()
Also, if we do this, event.buttonObject.up can be used and we dont need the
two isDown methods in wxGenButtonEvent.
Button ids could be used using event.GetId() but this gets a bit messy
relating this back to the button name if the ids are assigned automatically
using wxNewId() in another class. Maybe there is another way of doing this
that I dont know about.
> I tried to set the background colour to blue with
> SetBackgroundColour(wxBLUE) but it had no effect. I guess upFaceClr and
> downFaceClr need to be modified.
You'll need to change it back to the way it originaly was for that to happen.
You changes ignore the window background settings
> I think with the larger button default size a bezel of say 2 to 5 pixels
> will look ok. If a person really wants something more then they can set
> the size. Therefore I would not worry about it.
I've just moved it into a separate method, SetBestSize() that the programmer
can call after setting the bezel and/or the font. It also works with bitmap
buttons, with the best size being a bit larger than the bitmap plus room for
> > > And a question: When you use SetUseFocusIndicator(FALSE) it removes
> > > focus indicator but it still accepts a focus. Therefore the button
> > > change if a key hit. Is there a way so the button will not have any
> > > at all. Therefore, when you hit the tab key it will by-pass the button
> > > altogether?
> > >
> > Use the wxWindow.Enable method. The button classes check IsEnabled()
> > doing anything, and the wxDialog and wxPanel check it before tabing to
> > subwindows.
> I thought Enable was for enabling and disabling the button totally and not
> just the focus part.
As far as wxWindows is concerned it is the same thing. If a button can't get
the focus then it can't be acitvated to it is the same as disabled.
> I have another request. Can we attach the button object to the event in
> the Notify method
> def Notify(self):
> evt = wxGenButtonEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
> evt.SetIsDown(not self.up)
> evt.buttonObject= self #gw added
Yes, I was going to do this, guess I forgot... It's there now (in CVS.)
> I have a demo/example made up that uses your general buttons and puts them
> into a buttonbox with types push, radio and check using labels or bitmaps.
> Shows different bezel, gap sizes, etc.
> Are you interested in this for your demo program? If so, then you will
> need to send me your current copy of button.py because I will need to
> update my code.
Yes, I am but unfortunatly I've used a few more things that are only
available in my current version of wxPython so it may be more trouble than
On the other hand, I am working on something like an automated almost-daily
build of wxPython for MSW so I can more easily get some of this new stuff out
to you guys. (Those of you using GTK will have to wait a bit longer, though
I want to do something like this for you eventually too. In the meantime you
can get current sources from CVS.)