Jump to content
Sign in to follow this  
ParoXsitiC

Default Microsoft Windows Tray Template

Recommended Posts

ParoXsitiC

For the life of me I can't get a the tray to act like a standard Microsoft Windows tray.

Primary Click: Does nothing

Primary Double Click: Hides/Show GUI

Secondary Click: Shows Menu Items

Also how do you set a tray icon to be one that is "checkable" and one that is not?

Share this post


Link to post
Share on other sites
ParoXsitiC

Found the secret that was messing me up:

TraySetClick(8)

Never knew about the function. Argg.

Anyways heres what I got:

#include <Constants.au3>

Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu
Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown.

TrayCreateItem("About")
TrayItemSetOnEvent(-1, "On_About")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "On_Exit")

TraySetState()

TraySetClick(8)

TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "_DoNothing")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "_ShowGUI")

While 1
    sleep(100)
WEnd


Func _DoNothing()
EndFunc   ;==>_DoNothing


Func _ShowGUI()
    TrayTip("GUI", "Hello World", 1)
EndFunc   ;==>_ShowGUI

Func On_About()
    MsgBox(0, "About", "Whatever")
EndFunc   ;==>On_About

Func On_Exit()
    Exit
EndFunc   ;==>On_Exit

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.