Here is the explanation why managing the default behaviour in unibutton is necessary. Is it still true in 2.8.0?
[/i]"Everything you ever wanted to know about the default buttons" or "Why do we
have to do all this?"
In MSW the default button should be activated when the user presses Enter
and the current control doesn't process Enter itself somehow. This is
handled by ::DefWindowProc() (or maybe ::DefDialogProc()) using DM_SETDEFID
Another aspect of "defaultness" is that the default button has different
appearance: this is due to BS_DEFPUSHBUTTON style which is completely
separate from DM_SETDEFID stuff (!). Also note that BS_DEFPUSHBUTTON should
be unset if our parent window is not active so it should be unset whenever
we lose activation and set back when we regain it.
Final complication is that when a button is active, it should be the default
one, i.e. pressing Enter on a button always activates it and not another
We handle this by maintaining a permanent and a temporary default items in
wxControlContainer (both may be NULL). When a button becomes the current
control (i.e. gets focus) it sets itself as the temporary default which
ensures that it has the right appearance and that Enter will be redirected
to it. When the button loses focus, it unsets the temporary default and so
the default item will be the permanent default -- that is the default button
if any had been set or none otherwise, which is just what we want.
NB: all this is quite complicated by now and the worst is that normally
it shouldn't be necessary at all as for the normal Windows programs
DefWindowProc() and IsDialogMessage() take care of all this
automatically -- however in wxWindows programs this doesn't work for
nested hierarchies (i.e. a notebook inside a notebook) for unknown
reason and so we have to reproduce all this code ourselves. It would be
very nice if we could avoid doing it.