Sign in to follow this  
Followers 0
protoid

In-GUI shortcuts

4 posts in this topic

Easiest/fastest way to explain:

press file or alt+f

see the shortcuts justified right on the menu items? there should be things like "New Tab_______Ctrl+T"

Can you assign non-global hotkeys to functions or menu items like that natively in autoit?

I searched a bit on the forums and was not able to find much on the topic...

Share this post


Link to post
Share on other sites



accelarators!!

; A simple dialog showing accelerators in menus

#include <GUIConstantsEx.au3>

GUICreate("Accelerators", 210, 80)

$hRoot = GUICtrlCreateMenu ("&menu", -1)
   $hMenuItem1 = GUICtrlCreateMenuItem ("&New Tab" & @TAB & "Ctrl+T", $hRoot)
   $hMenuItem2 = GUICtrlCreateMEnuItem ("&Close Tab" & @TAB & "Ctrl+Y", $hRoot)
   $hMenuItem3 = GUICtrlCreateMenuItem ("&Exit" & @TAB & "Alt+F4", $hRoot)

; Set accelerators for Ctrl+t and Ctrl+y
Dim $AccelKeys[2][2]=[["^t", $hMenuItem1], ["^y", $hMenuItem2]]
GUISetAccelerators($AccelKeys)

GUISetState()  ; display the GUI

Do
    $msg = GUIGetMsg()
    Switch $msg
        Case $hMenuItem1
            MsgBox(0, "You clicked on", "Menu Item 1")
        Case $hMenuItem2
            MsgBox(0, "You clicked on", "Menu Item 2")
    EndSwitch
Until $msg = $GUI_EVENT_CLOSE Or $msg = $hMenuItem3

Mat

Share this post


Link to post
Share on other sites

Thank you! For the example and the name :)

Share this post


Link to post
Share on other sites

http://www.autoitscript.com/forum/index.php?showtopic=100552&st=0&p=718934&hl=accelerator&fromsearch=1&#entry718934

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