# Function Reference

TraySetClick

Sets the clickmode of the tray icon - what mouseclicks will display the tray menu.

TraySetClick ( flag )

Parameters

flag | 0 = Tray menu will never be shown through a mouseclick 1 = Pressing primary mouse button 2 = Releasing primary mouse button 4 = Pressing double primary mouse button 8 = Pressing secondary mouse button 16 = Releasing secondary mouse button 32 = Pressing double secondary mouse button 64 = Releasing or pressing any mouse button

Return Value

Success: | Returns 1.
Failure: | Returns 0.

Remarks

These flags are NOT tray event values!
Default value is "9" - pressing the primary or secondary mouse button will show the tray menu.

Related

None.

Example

#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
$settingsitem = TrayCreateMenu("Settings")
$displayitem = TrayCreateItem("Display", $settingsitem)
$printeritem = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
TraySetClick(16)
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $aboutitem
Msgbox(64,"About:","AutoIt3-Tray-sample")
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
Exit