# Function Reference

# TraySetClick

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

TraySetClick ( flag )

## Parameters

flag | $TRAY_CLICK_SHOW (0) = Tray menu will never be shown through a mouseclick $TRAY_CLICK_PRIMARYDOWN (1) = Pressing primary mouse button $TRAY_CLICK_PRIMARYUP (2) = Releasing primary mouse button $TRAY_DBLCLICK_PRIMARY (4) = Double-click primary mouse button $TRAY_CLICK_SECONDARYDOWN (8) = Pressing secondary mouse button $TRAY_CLICK_SECONDARYUP (16) = Releasing secondary mouse button $TRAY_DBLCLICK_SECONDARY (32) = Double-click secondary mouse button $TRAY_CLICK_HOVERING (64) = Hovering over the tray icon Constants are defined in "TrayConstants.au3"

## Return Value

None.

## 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

TraySetOnEvent

## Example

    #NoTrayIcon

    #include <MsgBoxConstants.au3>
    #include <StringConstants.au3>
    #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant.

    Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.

    Example()

    Func Example()
        Local $idAbout = TrayCreateItem("About")
        TrayCreateItem("") ; Create a separator line.

        Local $idExit = TrayCreateItem("Exit")

        TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
        TraySetClick($TRAY_CLICK_HOVERING) ; Show the tray menu when the mouse if hovered over the tray icon.

        While 1
            Switch TrayGetMsg()
                Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable.
                    MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _
                            "Version: " & @AutoItVersion & @CRLF & _
                            "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1)) ; Find the folder of a full path.

                Case $idExit ; Exit the loop.
                    ExitLoop
            EndSwitch
        WEnd
    EndFunc   ;==>Example