| Class TTrayIcon (unit TTrayIco) |
TComponent
| Constructors |
constructor Create(Owner: TComponent);| Functions |
destructor Destroy;
procedure Minimize;
procedure Restore;
procedure AppMinimize(Sender: TObject);
procedure AppRestore(Sender: TObject);
procedure Changed;
procedure Click;
procedure DblClick;
procedure DoMenu;
procedure DoMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoMouseMove(Shift: TShiftState; X, Y: Integer);
procedure DoMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure EndSession;
procedure OnMessage(var Msg: TMessage);
procedure SetHint(const Hint: string);
procedure SetIcon(Icon: TIcon);| Properties |
property Hint : string
property Icon : TIcon
property PopupMenu : TPopupMenu
property Data : TNotifyIconData| Events |
event OnClick : TNotifyEvent
event OnDblClick : TNotifyEvent
event OnMinimize : TNotifyEvent
event OnMouseDown : TMouseEvent
event OnMouseMove : TMouseMoveEvent
event OnMouseUp : TMouseEvent
event OnRestore : TNotifyEvent| Variables |
fClicked : Boolean;
fData : TNotifyIconData;
fHint : string;
fIcon : TIcon;
fOnClick : TNotifyEvent;
fOnDblClick : TNotifyEvent;
fOnMinimize : TNotifyEvent;
fOnMouseDown : TMouseEvent;
fOnMouseMove : TMouseMoveEvent;
fOnMouseUp : TMouseEvent;
fOnRestore : TNotifyEvent;
fPopupMenu : TPopupMenu;| Constructors |
constructor Create(Owner: TComponent);Create the component. At run-time, automatically add a tray icon with a callback to a hidden window. Use the application icon and title.
| Functions |
destructor Destroy;Remove the icon from the system tray.
procedure Minimize;When the application minimizes, hide it, so only the icon in the system tray is visible.
procedure Restore;Restore the application by making its window visible again, which is a little weird since its window is invisible, having no height or width, but that's what determines whether the button appears on the taskbar.
procedure AppMinimize(Sender: TObject);When the Application is minimized, minimize to the system tray.
procedure AppRestore(Sender: TObject);When restoring from the system tray, restore the application.
procedure Changed;Whenever any information changes, update the system tray.
procedure Click;
procedure DblClick;
procedure DoMenu;When the user right clicks the icon, call DoMenu. If there is a popup menu, and if the window is minimized, then popup the menu.
procedure DoMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoMouseMove(Shift: TShiftState; X, Y: Integer);
procedure DoMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure EndSession;Allow Windows to exit by deleting the shell notify icon.
procedure OnMessage(var Msg: TMessage);Message handler for the hidden shell notification window. Most messages use Wm_Callback_Message as the Msg ID, with WParam as the ID of the shell notify icon data. LParam is a message ID for the actual message, e.g., Wm_MouseMove. Another important message is Wm_EndSession, telling the shell notify icon to delete itself, so Windows can shut down. Send the usual Delphi events for the mouse messages. Also interpolate the OnClick event when the user clicks the left button, and popup the menu, if there is one, for right click events.
procedure SetHint(const Hint: string);Set a new hint, which is the tool tip for the shell icon.
procedure SetIcon(Icon: TIcon);Set a new icon. Update the system tray.
| Properties |
property Hint : string
property Icon : TIcon
property PopupMenu : TPopupMenu
property Data : TNotifyIconData| Events |
event OnClick : TNotifyEvent
event OnDblClick : TNotifyEvent
event OnMinimize : TNotifyEvent
event OnMouseDown : TMouseEvent
event OnMouseMove : TMouseMoveEvent
event OnMouseUp : TMouseEvent
event OnRestore : TNotifyEvent| Variables |
fClicked : Boolean;
fData : TNotifyIconData;
fHint : string;
fIcon : TIcon;
fOnClick : TNotifyEvent;
fOnDblClick : TNotifyEvent;
fOnMinimize : TNotifyEvent;
fOnMouseDown : TMouseEvent;
fOnMouseMove : TMouseMoveEvent;
fOnMouseUp : TMouseEvent;
fOnRestore : TNotifyEvent;
fPopupMenu : TPopupMenu;