I have a main window that is a subclass of wx.Frame and inside that a wx.Panel which is the parent of 3 other panels. One of these child panels has a wx.CheckBox, with the label ‘&Show Options’. When I run this on Linux I can toggle the checkbox using Alt+S as expected. But on Windows 7 this has no effect.
I tried making a small example by modifying the edit.py example I’d used for a previous question on this list: but when I did so Alt+S worked as expected on both Linux and Windows 7. So I’m very puzzled!
Where was the keyboard focus at the time you pressed Alt-S?
···
–
Robin
On Monday, April 22, 2019 at 12:01:09 AM UTC-7, Mark wrote:
I have a main window that is a subclass of wx.Frame and inside that a wx.Panel which is the parent of 3 other panels. One of these child panels has a wx.CheckBox, with the label ‘&Show Options’. When I run this on Linux I can toggle the checkbox using Alt+S as expected. But on Windows 7 this has no effect.
I tried making a small example by modifying the edit.py example I’d used for a previous question on this list: but when I did so Alt+S worked as expected on both Linux and Windows 7. So I’m very puzzled!
The keyboard focus is wherever wx puts it at startup – also I don’t want it to matter where it is. (My main window is dialog-style — buttons, spinboxes, etc., but no menu or toolbars).
On Monday, 22 April 2019 16:41:16 UTC+1, Robin Dunn wrote:
Did your sample also have multiple panels?
Where was the keyboard focus at the time you pressed Alt-S?
–
Robin
On Monday, April 22, 2019 at 12:01:09 AM UTC-7, Mark wrote:
I have a main window that is a subclass of wx.Frame and inside that a wx.Panel which is the parent of 3 other panels. One of these child panels has a wx.CheckBox, with the label ‘&Show Options’. When I run this on Linux I can toggle the checkbox using Alt+S as expected. But on Windows 7 this has no effect.
I tried making a small example by modifying the edit.py example I’d used for a previous question on this list: but when I did so Alt+S worked as expected on both Linux and Windows 7. So I’m very puzzled!
To be precise: you don't want it to matter for the *user
experience*. You, as programmer, may well have to care in
order to make the user experience happen.
(IOW, putting the initial focus somewhere "reliable").
Karsten
···
On Mon, Apr 22, 2019 at 11:15:43PM -0700, Mark wrote:
Rather than putting the focus somewhere I am now using a wx.AcceleratorTable with entries bound to the main window. The downside is that on Windows it means when you press say Alt+O the button with ‘&Open’ doesn’t visibly get clicked. I’ve “solved” that by binding each button accelerator to this:
def click_button(self, button, function):
color = button.GetForegroundColour() # Normally black
button.SetForegroundColour((0x19, 0x73, 0x19, 0xFF)) # Darkish green
wx.CallLater(200, button.SetForegroundColour, color)
function() # The actual function or bound method to call
which at least gives a visual cue.
···
On Tuesday, 23 April 2019 10:18:28 UTC+1, Karsten Hilbert wrote:
On Mon, Apr 22, 2019 at 11:15:43PM -0700, Mark wrote:
Yes, multiple panels:
±P0-------------+
P1 | P3 | P4 |
±----+ | |
P2 | | |
±---------------+
The keyboard focus is wherever wx puts it at startup – also I don’t want
it to matter where it is.
To be precise: you don’t want it to matter for the *user
experience*. You, as programmer, may well have to care in
order to make the user experience happen.
(IOW, putting the initial focus somewhere “reliable”).