HuBa
Joined: 24 Feb 2007 Posts: 172 Location: Budapest, Hungary
|
Posted: Mon Dec 17, 2007 8:01 pm Post subject: Popup menu by Left click on Tray icon |
|
|
I recently bought a TabletPC. This is a very interesting gadget because the user interface is mainly restricted to one button: the stylus tap on the touchscreen.
It is really struggling to configure the system to be able to work with only the left mouse button.
As an AHK developer, my first challenge was to popup the script's tray menu by clicking with the left mouse button on the script's tray icon.
Here is my solution:
| Code: | Menu Tray, Click, 1 ; Enable single click action on tray
Gosub AddMenu ; Add new default menu
Return ; End of initialization
ShowMenu:
Menu Tray, Delete, ShowMenu ; Delete temporary default menu item
MouseGetPos MouseX, MouseY ; Get current mouse position
Menu Tray, Show, %MouseX%, % MouseY - 10 ; Show menu a little upper to enable next click on icon
AddMenu:
Menu Tray, Add, ShowMenu ; Add temporary menu item
Menu Tray, Default, ShowMenu ; Set to default
Return |
After the menu appears the default menu item restores to Open standard menu.
So clicking on the tray icon again while the menu is shown allows you to show the script's main window (which is doubleclick afterall).
The temporary menu item remains invisible as long as you are using the left mouse button on tray icon.
For general purpose, this script can be used to assign two different menus for the script's tray icon: One with the left click, one with the right.
Just replace the 8th line in the original script to:
| Code: | | Menu MyLeftClickMenu, Show |
Last edited by HuBa on Mon Dec 17, 2007 10:12 pm; edited 1 time in total |
|