Opened 11 years ago

Last modified 3 years ago

#2268 closed defect

first wxRadiobutton enabled during focus

Reported by: ghazel Owned by:
Priority: normal Milestone:
Component: wxMSW Version:
Keywords: Cc: ghazel, botg, vadz, juliansmart
Blocked By: Blocking:
Patch: no


This is a re-visit on the issue that caused this bug report:
and this patch:

As of CVS HEAD just after 2.5.4 either patch was not
applied properly, or was not a thorough fix.

Attached is code that demonstrates the problem:

Both radiobuttons are set to False on initialization, then
the second is set to True. The app should start with two
windows - a frame with the focus, and the dialog with the
radiobuttons where the second is selected. If that dialog
is focused, however, the first radiobutton is selected
One strange aspect is that if the radiobuttons are placed
directly on the dialog with a sizer, this problem does not
occur (so the old demo code from the previous reports is
not useful in showing the problem).

just incase:
CVS HEAD 02/23/05
MSVC++ 7.1

Attachments (1)

radio_bug.cpp download (2.9 KB) - added by ghazel 11 years ago.
new radiobutton focus bug demo

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by botg

Interesting, the first radiobutton receives a WM_COMMAND
message with the BN_CLICKED parameter. Though I've no idea
where that is coming from.

comment:3 Changed 11 years ago by vadz

It should be fixed now that the patch has been applied,
please reopen if not.

comment:4 Changed 11 years ago by ghazel

CVS HEAD 05/09/05

This bug still exists in one form:
If SetValue() was called and the window with the radio
buttons never got focus, giving it focus will select the radio
button with default focus (the top button).
In my case I have the radiobuttons in a wxNotebook - calling
SetValue on a radiobutton, then showing the notebook for the
first time on a different page, then switching to the radiobutton
page shows the behavior.

I have updated the demonstration app with changes to show
this bug.

Changed 11 years ago by ghazel

new radiobutton focus bug demo

comment:5 Changed 11 years ago by ghazel

The most recent incantation of this bug seems partially due
to the fact that switching tabs on a wxNotebook automatically
selects a control on the notebook page. This is not native
behaviour, at least on win32, and breaks standard keyboard

comment:6 Changed 11 years ago by ghazel

In fact, I hunted down that wxNotebook code and patched it,
and those issues went away for me. The patch can be found

comment:7 Changed 10 years ago by juliansmart

Patch applied, thanks.

comment:8 Changed 3 years ago by VZ

(In [72657]) Do give focus to the wxNotebook page when switching to it under MSW.

Switching to the page but keeping the focus on the notebook itself makes it
difficult to use the UI from keyboard and is inconsistent with the behaviour
of native property sheets. Do restore the code to set the focus to the page as
the bug that resulted in a wrong radio button being selected when we did this
was apparently fixed elsewhere in the meanwhile because it doesn't happen any
more even with this change.

See #2268.

Note: See TracTickets for help on using tickets.