TMlTrayIcon
A tray icon component: it shows an icon in the Windows notification area with a context menu, balloon notifications and minimize-to-tray.
Notes
Iconis the icon to show andIconVisiblecontrols whether it appears.PopupMenuattaches the context menu; withLeftPopupon, a left click opens it too.- With
MinimizeToTrayon, minimizing the form hides it into the tray and firesOnMinimizeToTray. - For a blinking alert (new mail, say) put several icons in
IconList, turn onCycleIconsand setCycleInterval. - Separate events cover the balloon being shown, hidden, timing out and clicked, so you can react when the user clicks a notification.
Example
From the demo MlSkin.MainDemo.v3.0 (.dfm form file)
object mltrycn1: TMlTrayIcon
CycleInterval = 0
Icon.Data = {
000001000900303010000100040068060000960000002020100001000400E802
0000FE060000101010000100040028010000E60900003030000001000800A80E
00000E0B00002020000001000800A8080000B619000010100000010008006805
00005E2200003030000001002000A8250000C62700002020000001002000A810
00006E4D0000101000000100200068040000165E000028000000300000006000
0000010004000000000080040000000000000000000000000000000000000000
000000008000008000000080800080000000800080008080000080808000C0C0
C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0000FF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FF
FFFFFFFF78F8FFFFFFFFFFFFFFFFF8F88FFFFFFFFF0000FFFFFFFFFF77F7FFFF
FFFFFFFFFFFFF7F7F7FFFFFFFF0000FFFFFFFFF7F7F7FFFFFFFFFFFFFFFFF7F7
F7FFFFFFFF0000FFFFFFFFF787F7FFFFFFFFFFFFFFFFF887888FFFFFFF0000FF
FFFFFF887F88FFF8FF87878FFFFFFF788F7FFFFFFF0000FFFFFFFF7F7F7FFFF7
7788F887777FFF887F78FFFFFF0000FFFFFFF87F7F7FFF87FFFFFFFFF878FFF7
78F7FFFFFF0000FFFFFFF7F8888FFF7FFFFFFFFFFFF7FFF788F8FFFFFF0000FF
Properties 16
| Name | Type | Default | Description |
|---|---|---|---|
About | TMlAboutInfo | — | A design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm. |
DesignPreview | Boolean | False | Design-time preview: shows the tray icon while you are still in the IDE. |
IconList | TCustomImageList | — | The list of icons used for cycling, i.e. a blinking alert. |
IconList | TImageList | — | The list of icons used for cycling, i.e. a blinking alert. |
CycleIcons | Boolean | False | Cycles through the icons in IconList to make the tray icon blink. |
CycleInterval | Cardinal | — | Interval between icon changes, in milliseconds. |
Enabled | Boolean | True | Whether the control is usable; when off it greys out and stops responding. |
Hint | THintString | — | Tooltip text shown when the mouse rests on the control. |
ShowHint | Boolean | True | Whether a tooltip appears when the mouse rests on the tray icon. |
Icon | TIcon | — | The icon shown in the tray. |
IconVisible | Boolean | False | Whether the tray icon is visible. |
IconIndex | Integer | — | Which icon from IconList is currently shown. |
PopupMenu | TPopupMenu | — | The menu shown when the tray icon is right-clicked. |
LeftPopup | Boolean | False | Whether a left click also opens the menu. |
WantEnterExitEvents | Boolean | False | Whether mouse enter and exit events over the tray icon are reported. |
MinimizeToTray | Boolean | False | Hides the form into the tray when it is minimized, so it leaves the taskbar. |
Events 14
| Name | Type | Default | Description |
|---|---|---|---|
OnClick | TNotifyEvent | — | Fires when the control is clicked. |
OnDblClick | TNotifyEvent | — | Fires on a double click, usually used to show or hide the main form. |
OnMouseDown | TMouseEvent | — | Fires when a mouse button goes down. |
OnMouseUp | TMouseEvent | — | Fires when a mouse button is released. |
OnMouseMove | TMouseMoveEvent | — | Fires as the mouse moves over the control. |
OnMouseEnter | TNotifyEvent | — | Fires when the mouse enters the control. |
OnMouseExit | TNotifyEvent | — | Fires when the mouse leaves the tray icon; requires WantEnterExitEvents. |
OnCycle | TCycleEvent | — | Fires each time the cycling icon advances. |
OnBalloonHintShow | TNotifyEvent | — | Fires when the balloon notification appears. |
OnBalloonHintHide | TNotifyEvent | — | Fires when the balloon notification is hidden. |
OnBalloonHintTimeout | TNotifyEvent | — | Fires when the balloon notification closes on its own after timing out. |
OnBalloonHintClick | TNotifyEvent | — | Fires when the balloon notification is clicked, typically to open the matching window. |
OnMinimizeToTray | TNotifyEvent | — | Fires when the form is hidden into the tray. |
OnStartup | TStartupEvent | — | Fires at startup, once the tray icon has been created. |
Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.
Offline helpA PDF / CHM version is available for offline reading.