NotifyIcon Method (WINDOW)
PLBCMP GUI Only
The NotifyIcon method assigns an icon to the WINDOW object and puts the icon into the Windows icon tray. In addition, this methods allows tooltip text to be associated with the icon in the icon tray. The method uses the following format:
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A WINDOW object that is evalulated.
return
Optional. A Character String Variable that returns delimited data fields for the monitor data.
icon
Required. A Numeric Variable, decimal value, Character String Variable, or Character String literal that identifies the icon to be used in the Windows icon tray.
tooltip
Optional. A Character String Variable or literal that specifies the tooltip text to be assigned to the icon that is placed in the Windows icon tray.
Flags Affected: OVER, ZERO
Note the following:
The ZERO flag is set when the {return} value is zero. The {return} value is non-zero when the method execution fails. The ZERO flag is set to FALSE when the {return} values is non-zero.
The OVER flag is set if the {return} variable is too small to contain the value and it is truncated.
The following values can be returned in the {return} variable.
|
Value |
Meaning |
|
0 |
The method was executed successfully. |
|
1 |
The method failed because the icon identified by the {icon} parameter could not be loaded. |
|
2 |
Error occurred executing Shell_NotifyIcon with the NIM_DELETE command. |
|
3 |
Error occurred executing Shell_NotifyIcon with the NIM_MODIFY command. |
|
4 |
Error occurred executing Shell_NotifyIcon with the NIM_ADD command. |
|
99 |
Error when this method is not supported. |
The end-user application must execute an EVENTREGISTER for a CLICK event for the {object} WINDOW that executes the NotifyIcon method. The CLICK event for the WINDOW object is generated when an end-user performs left or right mouse click actions on the {icon} that has been put in the Windows icon tray.
The WINDOW click event result contains a value that gives the mouse cursor position where the mouse click action was performed. In this case, the result value contains the top left coordinates where the mouse click action occurred. The result value contains the top and left mouse position as follows:
result = ( LeftPosition * 10000 ) + TopPosition
Example:
|
Result |
FORM |
8 |
|
Left |
FORM |
4 |
|
Top |
FORM |
4 |
|
|
... |
|
|
|
UNPACK |
Result,Left,Top |
The WINDOW click event modifier contains a value that identifies the current mouse state bits as described in the documentation for the EVENTREGISTER instruction. The click event modifier can be a combination of the following bit values.
|
Value |
Meaning |
|
0 |
No modifier provided |
|
1 |
Alt key |
|
2 |
Ctl key |
|
4 |
Shift key |
|
8 |
Left mouse button down |
|
16 |
Right mouse button down. |
|
32 |
Double click |
An end-user application can remove an active NotifyIcon from the icon tray by executing the NotifyIcon method with the {icon} value set to a value of zero.
An end-user application can remove the ToolTip from an active NotifyIcon in the icon tray by executing the NotifyIcon method with a NULL string for the {tooltip} parameter.
If a WINDOW object has an active NotifyIcon in the icon tray when the WINDOW object is destroyed, the active NotifyIcon is automatically removed from the icon tray. However, if the MAINWINDOW has an active NotifyIcon in the icon tray, the active NotifyIcon remains active until the end-user application terminates the NotifyIcon or when the MAINWINDOW is destroyed as a program shutdowns.
Note: The behavior to allow an active NotifyIcon to persist when it is attached to the MAINWINDOW is implemented to allow a program to CHAIN without automatically having the NotifyIcon removed from the icon tray. However,the end-user application must always reset the click event using the EVENTREGISTER instruction after a CHAIN operation has been executed.
This method is not available when using the PL/B Web Server.
See Also: Method Syntax, WINDOW Methods
![]() |