sysTrayGetAction()

Returns the value of a given attribute for a system tray action identified by its ID. Supports checking if an action exists and reacting to system tray events.

Synopsis

anytype sysTrayGetAction(int id, string attribute)

Parameter

Parameter Description
id ID of the system tray action to query.
attribute

Following attributes are available:

  • enabled => returns the enabled state of the menu entry

  • visible => returns the visible state of the menu entry

  • separator => returns the separator state of the menu entry

  • text => returns the text of the menu entry

  • checkable => returns the checkable state of the menu entry

  • checked => returns the checked state of the menu entry

Return Value

Returns the value of the requested attribute. The datatype depends on the attribute queried.

If the attribute "exists" is queried, a boolean is returned to indicate whether the action ID exists.

Details

The function sysTrayGetAction() queries the value of an attribute for a system tray action by ID.

In addition, both sysTrayGetAction() and moduleGetAction() support the boolean attribute "exists", which returns true if the specified action ID is currently valid and registered, see example sysTrayGetAction() with 'exists' attribute.

To respond to an activated system tray action in a UI script, use uiConnect(callback, "sysTrayAction"). The callback function will be triggered with the action ID as parameter.

To respond to a direct click on the system tray icon, use uiConnect(callback, "sysTrayActivated"). The callback will receive a string parameter reason with one of the following values:

  • "Unknown" – Unknown reason
  • "Context" – Context menu was requested
  • "DoubleClick" – Tray icon was double-clicked
  • "Trigger" – Tray icon was clicked
  • "MiddleClick" – Middle mouse button clicked on tray icon
  • "MessageClicked" – Tray message was clicked (if supported)

sysTrayGetAction() with 'exists' attribute

if (sysTrayGetAction(17, "exists")) // returns true if the action with ID 17 is known               

React on system tray action

main()
{
  uiConnect("sysTrayAction", "sysTrayAction");
}
sysTrayAction(int id)
{
  DebugN("sysTray action triggered:", id);
}

Availability

CTRL

Assignment

System Tray