charvi Posted November 23, 2008 Share Posted November 23, 2008 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! Link to comment Share on other sites More sharing options...
Zedna Posted November 23, 2008 Share Posted November 23, 2008 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 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
charvi Posted November 23, 2008 Author Share Posted November 23, 2008 Thank you very much Zedna, this is exactly what I needed! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now