Please enable JavaScript to view this site.

KOL/MCK - User Guide

trayicon

 

Perhaps this is not the most necessary object for most applications. But I put it directly after the menu, tk. it appears to be almost as visual as the main menu - at least when used and activated. This is an object that encapsulates calls to API functions that display a certain icon in a specially designed area of ​​the system taskbar.

 

Such an icon (usually referred to as a "tray icon") allows the user to organize a visual connection with the application, which is temporarily hidden from his eyes, i.e. does not even take up the buttons on the taskbar. The application can permanently show its tray icon (or even several icons), or hide them as needed. There is also the ability to change the icon image on the fly, providing animation to show the activity or readiness of a background process.

 

All the specified functionality, and some additional features, is contained in the TTrayIcon object type. Its constructor:

 

NewTrayIcon(Parent, icon). Here Parent is a pointer to the window object (form), and icon is a handle to an hIcon icon. Initially, the object is created in an inactive state (the icon is not displayed in the system tray).

 

Object properties, methods and events:

 

Icon - descriptor of the hIcon type icon;

Active - state of activity;

Tooltip - a tooltip that appears when the mouse cursor stops over the icon. A maximum of 63 characters of this string are displayed (this is the system limit);

AutoRecreate - if you set this value to true, the icon will be automatically restored in the system tray if, for any reason, the Explorer.exe program is restarted. It is Windows Explorer that provides the system bar and other elements of the desktop. usually the user's "shell" of the system. Unfortunately, this program can also crash. Not all (even reputable) applications provide automatic self-recovery of the tray icon after such an incident, and as a result, if their windows are hidden, it is not so easy to return them to the screen;

NoAutoDeactivate - by default, this property is false, i.e. automatic deactivation of the icon is provided when the application is closed;

Wnd - handle to the window used to receive mouse messages. Initially, this is the window of the Parent object specified when the object was created. It is also possible to attach a message handler to a foreign window (not the window of the KOL.TControl object) using the AttachProc2Wnd method;

AttachProc2Wnd - attaches a handler to an arbitrary Wnd window of the application. Such a window can process messages for several different TTrayIcon objects without restriction;

DetachProc2Wnd - detaches the handler from the Wnd window;

OnMouse - a mouse event that occurs when the mouse cursor moves over the icon of an object in the system area, and when the mouse is clicked on it. The handler receives, besides the sender, only the message type (WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MOUSEMOVE, WM_LBUTTONDBLCLK, etc.). Other parameters, such as the coordinates of the mouse cursor on the screen, must be obtained by the application itself;

 

In MCK, the TTrayIcon object corresponds to the mirror component TKOLTrayIcon.

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC