On 10/08/2007, Veli-Pekka T=E4til=E4 <vtatila@...> wrote:
> Is there a method I can call to programmatically click a menu item? I'm
> planning on calling it in the Ctrl+N handler in my accelerator table.
Not that I'm aware of.
> I guess I could call the underlying subs that my menu items call, but
> I'd rather have the keyboard control the UI, in stead.
In C/C++ you'd create the Accelerator and Menu item with the same ID,
and the the OS would do this all automatically for you (both
Accelerators and Menu items generate WM_COMMAND messages, with a flag
set to indicate which was used, but I don't see a way to utilise this
functionality with Win32::GUI)
> Its highly useful
> for push buttons, for instance. As the hotkey pushes the button, the
> user gets visual feedback and also as a screne reader user, I get
> notified of the focus and button state change accordingly. is it
> slightly "unorthodox" to click menus in hotkey handlers like that, in
> staed of activating the underlying function? As a user I've always
> disliked the fact that nothing visual happens when I save using the hot
> key. SO I press alt+f, s in stead, and then the screen reader tells me
> the file menu opens and closes confirming that something in deed
> happened. Part of my desire to try the programmatic clicking of menu
> items, too, would be to give this kind of visual feedback, even when the
> hotkeys are used.
You could probably code the hotkey handler to post 'alt-f' and 's'
keystrokes to the thread's message queue, which might work.