Re: [wx-dev] wxComboBox/wxChoice

185 views
Skip to first unread message

Neum...@zdf.de

unread,
Nov 28, 2005, 9:13:07 AM11/28/05
to wx-...@lists.wxwindows.org
Hi,

sorry it took so long.

The problem can't be reproduced with the controls sample. The reason is,
that the problem only occurs under these circumstances:
- a combo-box entry is selected with a left mouse-click *from the list*
(NOT with mouse-wheel or keyboard).
- it is the first combo-box event after a combobox->SetSelection()
It seems these circumstances never occur in the controls-example.

It can be reproduced with a simple program with only one dialog with a
combo-box in it. The combo-box should contain a few entries and one of
the entries must be selected at the start of the program with
SetSelection(0). If you select the 3rd entry from the list two events
will occur, one with event.GetInt() == 0 (!) and the second one with
event.GetInt() == 2!

In my program this behaviour causes even more problems, because
displayed data is interdependant. To reflect all possible effects the
new selection may have on the other data on each input-event I take the
value from the event, update my data and transfer the complete updated
data-set to the dialog. This will of course call SetSelection() and
cause the problem to occur *everytime* a combo-box entry is selected
with left-click. Because the first of the two combobox-events carries
the *old* selection it will even block the change of the selection (at
least if you use left mouse-button).

Regards,
Robert.

Geert Vancompernolle

unread,
Jan 27, 2006, 1:00:32 AM1/27/06
to wx-...@lists.wxwidgets.org
Vadim Zeitlin <vadim@...> writes:

>
> On Mon, 28 Nov 2005 15:13:07 +0100 Neumann.R@... wrote:
>
> > The problem can't be reproduced with the controls sample. The reason is,
> > that the problem only occurs under these circumstances:
> > - a combo-box entry is selected with a left mouse-click *from the list*
> > (NOT with mouse-wheel or keyboard).
> > - it is the first combo-box event after a combobox->SetSelection()
> > It seems these circumstances never occur in the controls-example.
>

> Could you please make a patch to the sample reproducing the problem?


>
> > It can be reproduced with a simple program with only one dialog with a
> > combo-box in it.
>

> Or a patch to the minimal sample showing it there?


>
> > the entries must be selected at the start of the program with
> > SetSelection(0). If you select the 3rd entry from the list two events
> > will occur, one with event.GetInt() == 0 (!) and the second one with
> > event.GetInt() == 2!
>

> This is clearly wrong but it would really help to have some code
> reproducing the problem to debug it.
>
> Thanks,
> VZ
>


Hi Vadim,

It's not that difficult to reproduce with the combo box sample app:

1. Start the controls.cpp application
2. Go to the wxComboBox tab
3. !!!First press the "Select #2" button!!!
4. Then select another item in the combobox.
5. => twice the combobox event.

If you start up the sample app and select *immediately* an item in the combobox,
then you don't have the problem, since there has not yet been a call to
SetSelection().
So, to me, the 'SetSelection()' screws up the things (and as a consequence, the
story of Robert comes into the picture).

HTH.

Best rgds,

--Geert

PS. has posted a similar message on the wxWidgets forum, since I have exactly
the same problem and I didn't know it was already handled here...


Vadim Zeitlin

unread,
Jan 27, 2006, 7:42:46 PM1/27/06
to wx-...@lists.wxwidgets.org
On Fri, 27 Jan 2006 06:00:32 +0000 (UTC) Geert Vancompernolle <geert.vanc...@gmail.com> wrote:

GV> It's not that difficult to reproduce with the combo box sample app:
GV>
GV> 1. Start the controls.cpp application
GV> 2. Go to the wxComboBox tab
GV> 3. !!!First press the "Select #2" button!!!
GV> 4. Then select another item in the combobox.
GV> 5. => twice the combobox event.

Ok, I do see this and the fix is trivial: this happens just because
SetSelection() doesn't update m_selectionOld and so there is a mismatch
between what the selection really is and what combobox thinks it is. I've
fixed this in both HEAD and 2.6 branches.

GV> So, to me, the 'SetSelection()' screws up the things (and as a
GV> consequence, the story of Robert comes into the picture).

If there is really nothing more to it, then it must be fixed now. But I'm
not 100% sure it's the same bug because I don't remember any mentions of
SetSelection() in the original bug report.

Anyhow, thanks for showing me how to reproduce the problem!
VZ


Reply all
Reply to author
Forward
0 new messages