AutoHotkey Community

It is currently May 26th, 2012, 4:43 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: December 17th, 2007, 9:01 pm 
Offline

Joined: February 24th, 2007, 6:02 pm
Posts: 175
Location: Budapest, Hungary
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 December 17th, 2007, 11:12 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2007, 9:29 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Clever! A different left-click tray menu is often useful. With this script it became easy.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Good :)
PostPosted: April 1st, 2009, 10:06 am 
Offline

Joined: April 1st, 2009, 10:04 am
Posts: 1
Really helpful!

Thanks.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Rajat, Yahoo [Bot] and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group