Re: [wx-dev] Wrong selection in wxListBox on Mac OS X, wxWidgets 2.9.4

20 views
Skip to first unread message

Vadim Zeitlin

unread,
Sep 26, 2012, 7:00:19 AM9/26/12
to wx-...@googlegroups.com
On Wed, 26 Sep 2012 03:44:44 -0700 (PDT) Daniel Dekkers wrote:

DD> When I do...
DD>
DD> m_ListBox->Insert(wxT("Entry0"), 0);
DD> m_ListBox->Insert(wxT("Entry1"), 1);
DD> m_ListBox->Insert(wxT("Entry2"), 2);
DD> m_ListBox->Select(1);
DD> m_ListBox->Delete(0);
DD>
DD> ... "Entry2" ends up as the current selection on Mac OS X. This can't be
DD> right.

No, it looks like a bug. I believe we even have unit test for this one but
it might be disabled under OS X as quite a few other tests right now.

Which port (Carbon or Cocoa) do you use?

DD> Any way to avoid this, or is wxListBox deprecated in favour of wxListCtrl?

No, it's not deprecated, the bug "just" needs to be fixed.

Regards,
VZ

Daniel Dekkers

unread,
Sep 26, 2012, 11:03:53 AM9/26/12
to wx-...@googlegroups.com
Hi,

I'm using the Cocoa framework.
Avoided the problem by using wxListView, which I should have done anyway because i want drag&drop functionality.

Found another thing that feels like a bug though: wxTextCtrls don't get a kill focus event when a different window is selected (parent window of the wxTextCtrl loses focus).
On Windows they do. I'll try to figure out how to file bug reports for wxWidgets.

Thanks,
Daniel

Vadim Zeitlin

unread,
Sep 26, 2012, 12:21:08 PM9/26/12
to wx-...@googlegroups.com
On Wed, 26 Sep 2012 17:03:53 +0200 Daniel Dekkers wrote:

DD> I'm using the Cocoa framework.

Please open a ticket on trac.wxwidgets.org for this bug. Please check if
you can reproduce it in the listbox page of the widgets sample.

DD> Found another thing that feels like a bug though: wxTextCtrls don't get
DD> a kill focus event when a different window is selected (parent window
DD> of the wxTextCtrl loses focus).

Again, please check if you can reproduce the problem in the text sample
and open a ticket if so (and if not, please try to find what do you do
differently in your code that results in different behaviour).

Also, please search the existing tickets, the latter problem might have
been already reported, I have some vague memories of already seeing
something like this.

Thanks,
VZ

Daniel Dekkers

unread,
Oct 6, 2012, 2:11:26 PM10/6/12
to wx-...@googlegroups.com

On Sep 26, 2012, at 6:21 PM, Vadim Zeitlin wrote:

> On Wed, 26 Sep 2012 17:03:53 +0200 Daniel Dekkers wrote:
>
> DD> I'm using the Cocoa framework.
>
> Please open a ticket on trac.wxwidgets.org for this bug. Please check if
> you can reproduce it in the listbox page of the widgets sample.

I really can't because in the sample(s) there is no new selection made when the current selected item is deleted.
I'll create a small demo and add a ticket.

> DD> Found another thing that feels like a bug though: wxTextCtrls don't get
> DD> a kill focus event when a different window is selected (parent window
> DD> of the wxTextCtrl loses focus).
>
> Again, please check if you can reproduce the problem in the text sample
> and open a ticket if so (and if not, please try to find what do you do
> differently in your code that results in different behaviour).
>
> Also, please search the existing tickets, the latter problem might have
> been already reported, I have some vague memories of already seeing
> something like this.

Yes:
http://trac.wxwidgets.org/ticket/14142
I've added a comment and a small demo to that ticket.
Very annoying bug if you want to check (and maybe correct) the validity of user input in a wxTextCtrl without having to resort to some kind of "apply now" control path.
You don't want to check on every wxEVT_COMMAND_TEXT_UPDATED event either, while the user is still typing.

> Thanks,
> VZ

Thanks,
Daniel

Vadim Zeitlin

unread,
Oct 6, 2012, 5:51:41 PM10/6/12
to wx-...@googlegroups.com
On Sat, 6 Oct 2012 20:11:26 +0200 Daniel Dekkers wrote:

DD> On Sep 26, 2012, at 6:21 PM, Vadim Zeitlin wrote:
DD>
DD> > On Wed, 26 Sep 2012 17:03:53 +0200 Daniel Dekkers wrote:
DD> >
DD> > DD> I'm using the Cocoa framework.
DD> >
DD> > Please open a ticket on trac.wxwidgets.org for this bug. Please check if
DD> > you can reproduce it in the listbox page of the widgets sample.
DD>
DD> I really can't because in the sample(s) there is no new selection made
DD> when the current selected item is deleted.

Please just add the missing parts to the sample and attach a patch with
your changes (please see http://trac.wxwidgets.org/wiki/HowToSubmitPatches
if you hadn't done this before) if possible.

DD> > DD> Found another thing that feels like a bug though: wxTextCtrls don't get
DD> > DD> a kill focus event when a different window is selected (parent window
DD> > DD> of the wxTextCtrl loses focus).
...
DD> Yes:
DD> http://trac.wxwidgets.org/ticket/14142
DD> I've added a comment and a small demo to that ticket.
DD> Very annoying bug if you want to check (and maybe correct) the validity of user input in a wxTextCtrl without having to resort to some kind of "apply now" control path.
DD> You don't want to check on every wxEVT_COMMAND_TEXT_UPDATED event either, while the user is still typing.

Yes, this is indeed very annoying. I hope Stefan can look into this
though because you could summarize everything I know about focus handling
under Mac on a back of a post stamp with plenty of space remaining.

Regards,
VZ
Reply all
Reply to author
Forward
0 new messages