Sign in to follow this  
Followers 0
charvi

Menu Shortcut

3 posts in this topic

Is there a way to add a shortcut in the menu?

For example, File/Open should have a Ctrl+O right aligned in the menu. How do I add this in the menu programmatically?

And how do I trap Ctrl+O ?

A code example is much appreciated.

Thanks!

Share this post


Link to post
Share on other sites



Use Koda for with its menu designer, it supports also hotkeys (GUISetAccelerators)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$MenuItem2 = GUICtrlCreateMenu("MenuItem2")
$MenuItem4 = GUICtrlCreateMenuItem("New" & @TAB & "Ctrl+A", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenuItem("MenuItem3", $MenuItem2)
$MenuItem1 = GUICtrlCreateMenu("MenuItem1")
GUISetState(@SW_SHOW)
Dim $Form1_AccelTable[1][2] = [["^a", $MenuItem4]]
GUISetAccelerators($Form1_AccelTable)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem4
            MsgBox(0,'','New was invoked')
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Thank you very much Zedna, this is exactly what I needed!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0