Jump to content

Menu Shortcut


charvi
 Share

Recommended Posts

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

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...