Problem with latest gtk2 and ComboPopup

Robin Dunn wrote:

Frank Millman wrote:
>
> Thanks for the response, Robin. I tried a number of things,
but none of them
> worked.
>

Sorry, I think I am lost. Do you have a simple sample?

Sorry about that. Here is a sample app.

I want to navigate the screen using only the keyboard, as follows -

Enter first field, then tab.

The second field is the combobox. Open the popup with either space or F4,
use the up/down arrows to make a selection, then confirm by pressing enter
or tab or space. It closes the popup and navigates to the next field.

Enter third field, then tab, etc, etc.

This is not the native behaviour, but with my modifications I can get it to
work like this on msw.

On gtk2, I can open the combobox with space or F4, but once it is open, it
does not respond to the keyboard at all, it only responds to a mouse click.

Hope this is clearer.

Frank

fm55b.py (5.32 KB)

Frank Millman wrote:

I want to navigate the screen using only the keyboard, as follows -

Enter first field, then tab.

The second field is the combobox. Open the popup with either
space or F4,
use the up/down arrows to make a selection, then confirm by
pressing enter
or tab or space. It closes the popup and navigates to the next field.

Enter third field, then tab, etc, etc.

This is not the native behaviour, but with my modifications I
can get it to
work like this on msw.

On gtk2, I can open the combobox with space or F4, but once
it is open, it
does not respond to the keyboard at all, it only responds to
a mouse click.

I don't know if I need to provide further motivation for my belief that the
current behaviour of wx.ComboBox on gtk2 is flawed, but it can't do any
harm.

I am using a ComboBox to emulate a wx.Choice. I have modified my sample
program to include a normal wx.Choice, so that the behaviour can be
compared.

When you tab to the wx.Choice, you can open it to show all the choices,
using F4 on msw and space on gtk2. Focus is automatically transferred to the
dropdown box. You can use the keyboard to make a selection, and press enter
to accept it. As explained above, the ComboBox does not respond to the
keyboard on gtk2 once the popup is opened.

The reason I don't want to use a standard wx.Choice is because of the
different keystrokes required to open it. My typical user could be using a
linux or a windows workstation as a client, and I want the behaviour to be
identical on both platforms.

Hope this explains why I am keen to get a solution.

Frank

fm55c.py (5.59 KB)

Frank Millman wrote:

Frank Millman wrote:
  

I want to navigate the screen using only the keyboard, as follows -

Enter first field, then tab.

The second field is the combobox. Open the popup with either space or F4,
use the up/down arrows to make a selection, then confirm by pressing enter
or tab or space. It closes the popup and navigates to the next field.

Enter third field, then tab, etc, etc.

This is not the native behaviour, but with my modifications I can get it to
work like this on msw.

On gtk2, I can open the combobox with space or F4, but once it is open, it
does not respond to the keyboard at all, it only responds to a mouse click.

I don't know if I need to provide further motivation for my belief that the
current behaviour of wx.ComboBox on gtk2 is flawed, but it can't do any
harm.

I am using a ComboBox to emulate a wx.Choice. I have modified my sample
program to include a normal wx.Choice, so that the behaviour can be
compared.

When you tab to the wx.Choice, you can open it to show all the choices,
using F4 on msw and space on gtk2. Focus is automatically transferred to the
dropdown box. You can use the keyboard to make a selection, and press enter
to accept it. As explained above, the ComboBox does not respond to the
keyboard on gtk2 once the popup is opened.

The reason I don't want to use a standard wx.Choice is because of the
different keystrokes required to open it. My typical user could be using a
linux or a windows workstation as a client, and I want the behaviour to be
identical on both platforms.

Hope this explains why I am keen to get a solution.

Frank

Well, an inelegant way to do this is to add some platform specific code that catches key press events and does special things depending on which key is pressed. Something like this, I suppose

myCombo.Bind(wx.EVT_KEY_DOWN, onKeyPress)

Then in the handler, you'd do something like this:

keycode = event.GetKeyCode() if keycode == SomeKeyCode:
   #Do something here

Ugly? Yes. Will it work? Probably...

ยทยทยท

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

__________ Information from ESET NOD32 Antivirus, version of virus signature database 3986 (20090403) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com