As a convenience of use, I'd like to allow keyboard
navigation of controls that use a wxComboCtrl and
then whatever the popup is, e.g. a wxCheckListBox.
I hope to have a number of these be quickly tabbed
through and items selected without having to use
the mouse.
I have two problems:
1) I can get the ComboCtrl to show its popup by binding
an wx.EVT_TEXT_ENTER to it and then using
.ShowPopup() in the event handler. But then I can't
figure out how to allow a second enter to hide the
popup, because while it is popped up it doesn't seem
to get the enter event.
2) How can I use the arrow keys to navigate the
CheckListBox that is popped up and the space
bar to check off items? That is the normal functionality
of the CheckListBox, but so far, it doesn't respond to the
arrow keys as it would if it were standalone (not part of a
ComboCtrl).
The attached small runnable sample shows what I have
so far.
The attached small runnable sample shows what I have
so far.
Sorry, I realized there was an extraneous import and an
extra line at the end that cluttered it a bit. To be clearer,
those are removed in the attached corrected version.
As a convenience of use, I'd like to allow keyboard
navigation of controls that use a wxComboCtrl and then
whatever the popup is, e.g. a wxCheckListBox.
I hope to have a number of these be quickly tabbed through
and items selected without having to use the mouse.
I had a similar requirement, though I limited myself to implementing the
equivalent of a wxChoice control, using a wxListBox. I got it working, with
some effort. See attached.
Features are -
- F4 or space bar opens the popup (MSW uses F4, gtk2 uses space, so I made
it work with both)
- up/down arrows move within the popup
- F4 or space or tab or enter or mouse-click selects the item
- at present keyboard selection also forces navigation to the next control,
but I may remove this - I'm not sure it is intuitive
- escape closes the popup without changing the current selection
- up/down arrows *without* opening the popup scroll through the items
in-situ - tab selects the visible item
I don't know how applicable it is to any other sort of popup, but it may
give you some ideas.
Thank you, Frank, I will look through it and see if it does give me some ideas.
Che
ยทยทยท
On Mon, Oct 26, 2009 at 2:30 AM, Frank Millman <frank@chagford.com> wrote:
C M wrote:
As a convenience of use, I'd like to allow keyboard
navigation of controls that use a wxComboCtrl and then
whatever the popup is, e.g. a wxCheckListBox.
I hope to have a number of these be quickly tabbed through
and items selected without having to use the mouse.
I had a similar requirement, though I limited myself to implementing the
equivalent of a wxChoice control, using a wxListBox. I got it working, with
some effort. See attached.
Features are -
- F4 or space bar opens the popup (MSW uses F4, gtk2 uses space, so I made
it work with both)
- up/down arrows move within the popup
- F4 or space or tab or enter or mouse-click selects the item
- at present keyboard selection also forces navigation to the next control,
but I may remove this - I'm not sure it is intuitive
- escape closes the popup without changing the current selection
- up/down arrows *without* opening the popup scroll through the items
in-situ - tab selects the visible item
I don't know how applicable it is to any other sort of popup, but it may
give you some ideas.