When I press the up arrow on Linux, the last text string from
that list is put into the ComboBox, when I press the down arrow,
the first text string from that list is put into the ComboBox.
I believe this is correct. At least it is the behaviour I expect.
On Windows, both up arrow and down arrow put the first text string
(self.history[]) into the ComboBox.
Is this a bug or a feature?
Is there any way to configure the ComboBox, so it behaves
correctly under Windows?
I was using 2.8.7.1 with Python 2.5.2.
I updated to 2.8.10.1 to see if that fixes the problem.
Unfortunately, the problem still exists in 2.8.10.1.
When I press the up arrow on Linux, the last text string from
that list is put into the ComboBox, when I press the down arrow,
the first text string from that list is put into the ComboBox.
I believe this is correct. At least it is the behaviour I expect.
On Windows, both up arrow and down arrow put the first text string
(self.history) into the ComboBox.
Is this a bug or a feature?
Is there any way to configure the ComboBox, so it behaves
correctly under Windows?
I was using 2.8.7.1 with Python 2.5.2.
I updated to 2.8.10.1 to see if that fixes the problem.
Unfortunately, the problem still exists in 2.8.10.1.
TIA for any help!
Carsten.
I'm not aware of a way to make ComboBox do that itself. But you should
be able to catch the key event from the arrow keys and just handle it
in the key press handler.
When I press the up arrow on Linux, the last text string from
that list is put into the ComboBox, when I press the down arrow,
the first text string from that list is put into the ComboBox.
I believe this is correct. At least it is the behaviour I expect.
On Windows, both up arrow and down arrow put the first text string
(self.history) into the ComboBox.
Is this a bug or a feature?
Neither. It's just the way that the native widgets work, and each is correct for the platform as far as the platform designers are concerned.
> When I press the up arrow on Linux, the last text string from
> that list is put into the ComboBox, when I press the down arrow,
> the first text string from that list is put into the ComboBox.
> I believe this is correct. At least it is the behaviour I expect.
>
> On Windows, both up arrow and down arrow put the first text string
> (self.history) into the ComboBox.
...
I'm not aware of a way to make ComboBox do that itself. But you should
be able to catch the key event from the arrow keys and just handle it
in the key press handler.
This sounded like a good idea, so I implemented it.
As you see in the original code above, I already have
the wx.WANTS_CHARS flag set and a wx.EVT_CHAR handler
implemented, so all I needed to do was extend that handler:
def on_text_char(self, event):
"""
A character key has been pressed.
"""
if event.KeyCode == wx.WXK_TAB:
self.request_file_name_completion()
elif event.KeyCode == wx.WXK_RETURN:
self.process_input_text()
elif event.KeyCode == wx.WXK_ESCAPE:
self.shell.stdin.write(chr(event.KeyCode) + '\n')
elif event.KeyCode == wx.WXK_UP:
self.move_history_index(-1)
elif event.KeyCode == wx.WXK_DOWN:
self.move_history_index(+1)
else:
event.Skip() # let wx process all other key codes.
Under Linux, this works fine, too (like my original code).
Under Windows, on_text_char does not get called at all
when I press an arrow key.
> When I press the up arrow on Linux, the last text string from
> that list is put into the ComboBox, when I press the down arrow,
> the first text string from that list is put into the ComboBox.
> I believe this is correct. At least it is the behaviour I expect.
>
> On Windows, both up arrow and down arrow put the first text string
> (self.history) into the ComboBox.
...
I'm not aware of a way to make ComboBox do that itself. But you should
be able to catch the key event from the arrow keys and just handle it
in the key press handler.
This sounded like a good idea, so I implemented it.
As you see in the original code above, I already have
the wx.WANTS_CHARS flag set and a wx.EVT_CHAR handler
implemented, so all I needed to do was extend that handler:
def on_text_char(self, event):
"""
A character key has been pressed.
"""
if event.KeyCode == wx.WXK_TAB:
self.request_file_name_completion()
elif event.KeyCode == wx.WXK_RETURN:
self.process_input_text()
elif event.KeyCode == wx.WXK_ESCAPE:
self.shell.stdin.write(chr(event.KeyCode) + '\n')
elif event.KeyCode == wx.WXK_UP:
self.move_history_index(-1)
elif event.KeyCode == wx.WXK_DOWN:
self.move_history_index(+1)
else:
event.Skip() # let wx process all other key codes.
Under Linux, this works fine, too (like my original code).
Under Windows, on_text_char does not get called at all
when I press an arrow key.