Pauletp Posted April 18, 2009 Share Posted April 18, 2009 Align shortcuts on the right side of menu entries: I would like to find a way to automatically align shortcuts on the right side of the menu entry in an Autoit GUI. This is the usual look for many programs. For example, in Firefox if you click on the the File menu you get the following drop down menu (without the broken lines I have put in here just to simulate the format) which has the shortcuts aligned on the right side of the menu entries:FileNew Window-------------Ctrl+NNew Tab-------------------Ctrl+TOpen location------------Ctrl+Letc In AutoIt I have a GUI with the lines$MenuItemSearch = GUICtrlCreateMenu("Search") $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find title-----------CTRL+F", $MenuItemSearch) Dim $Form1_1_AccelTable[1][2] = [["^f", $MenuItemSearchTitle]] GUISetAccelerators($Form1_1_AccelTable)AutoIt has the information there is a shortcut by the linesDim $Form1_1_AccelTable[1][2] = [["^f", $MenuItemSearchTitle]] GUISetAccelerators($Form1_1_AccelTable)and you can see that in the line $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find title-----------CTRL+F", $MenuItemSearch)I have manually placed the shortcut in the menu with the characters "Find title-----------CTRL+F".I would like to make some tidy menues. Does anybody have an idea how to automatically align shortcuts on the right side of the menu entries in AutoIt without doing it the manual way?Many thanks for a tip. Link to comment Share on other sites More sharing options...
ProgAndy Posted April 18, 2009 Share Posted April 18, 2009 It should work when you use a tab as delimiter GUICreate("test") $MenuItemSearch = GUICtrlCreateMenu("Search") $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find title" & @TAB & "CTRL+F", $MenuItemSearch) $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find text ...LONG..." & @TAB & "CTRL+G", $MenuItemSearch) Dim $Form1_1_AccelTable[1][2] = [["^f", $MenuItemSearchTitle]] GUISetAccelerators($Form1_1_AccelTable) GUISetState() While GUIGetMsg()<>-3 WEnd *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Pauletp Posted April 22, 2009 Author Share Posted April 22, 2009 It should work when you use a tab as delimiter GUICreate("test") $MenuItemSearch = GUICtrlCreateMenu("Search") $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find title" & @TAB & "CTRL+F", $MenuItemSearch) $MenuItemSearchTitle = GUICtrlCreateMenuItem("Find text ...LONG..." & @TAB & "CTRL+G", $MenuItemSearch) Dim $Form1_1_AccelTable[1][2] = [["^f", $MenuItemSearchTitle]] GUISetAccelerators($Form1_1_AccelTable) GUISetState() While GUIGetMsg()<>-3 WEnd Well that will certainly do the alignment. Thanks for the tip. No one else has reacted so I suppose there is no other obvious way to use the information contained in the accelerator table to automate the shortcut display in the menu. 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