1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <title>CoolTrayIcon, ver. 4.3.1</title>
|
---|
5 |
|
---|
6 | <style type='text/css'>
|
---|
7 | /* body { font-family: MS Sans Serif; font-size: 12pt; } */
|
---|
8 | h1 { font: bold 14pt Arial; margin-bottom: 10px; }
|
---|
9 | h2 { font: bold 12pt Arial; margin-bottom: 10px; margin-top: 40px; }
|
---|
10 | td.name { background-color: #FFFFC0; width: 120px; font-weight: bold; }
|
---|
11 | td.name2 { background-color: #FFCCCC; width: 120px; font-weight: bold; }
|
---|
12 | td.desc { background-color: #F0F0F0; }
|
---|
13 | td.default { background-color: #F0F0F0; }
|
---|
14 | ul { margin-left: 15px; margin-top: 5px; }
|
---|
15 | li { margin-bottom: 10px; }
|
---|
16 | .declaration { font-weight: bold; }
|
---|
17 | </style>
|
---|
18 |
|
---|
19 | </head>
|
---|
20 |
|
---|
21 |
|
---|
22 | <body topmargin='15' bottommargin='15' leftmargin='10' rightmargin='10'>
|
---|
23 |
|
---|
24 | <a name='Top'><h1>CoolTrayIcon, ver. 4.3.1</h1>
|
---|
25 |
|
---|
26 |
|
---|
27 | <a href='#Properties'>[Properties]</a> <a href='#Methods'>[Methods]</a> <a href='#Events'>[Events]</a>
|
---|
28 | <br>
|
---|
29 | <a href='#Hints'>[Hints]</a> <a href='#Bugs'>[Known Bugs]</a> <a href='#Comments'>[Comments]</a>
|
---|
30 | <br>
|
---|
31 |
|
---|
32 |
|
---|
33 | <p>
|
---|
34 | CoolTrayIcon is a tray icon component. It allows you to easily implement tray icons
|
---|
35 | in your own applications, with various appearances and behaviors.
|
---|
36 | </p>
|
---|
37 |
|
---|
38 | <!--
|
---|
39 | <p>
|
---|
40 | CoolTrayIcon can be used in a service. See my <a href='#Service'>developer remarks</a> on services.
|
---|
41 | </p>
|
---|
42 | -->
|
---|
43 |
|
---|
44 |
|
---|
45 | <a name='Properties'></a><h2>Properties</h2>
|
---|
46 |
|
---|
47 | <table cellpadding='2' cellspacing='2' border='0' width='100%'>
|
---|
48 | <tr>
|
---|
49 | <td class='name' valign='top'>Icon</td>
|
---|
50 | <td class='desc' valign='top'><span class='declaration'>property Icon: TIcon;</span><br>
|
---|
51 | The icon to display in the tray. This icon is 16x16 pixels and 256 colors (16 colors
|
---|
52 | in Win9x and NT). If you use an icon file (*.ico) containing more than one icon,
|
---|
53 | Delphi will use the first icon. If it's not 16x16 it will be scaled, which probably
|
---|
54 | won't look good.<br>
|
---|
55 | <!--
|
---|
56 | <b>NOTE:</b> Assigning a new TIcon object to Icon will cause the icon in the tray
|
---|
57 | to redraw. However, this is not the case if you change Icon through the TIcon.Assign
|
---|
58 | method, or change it through TIcon.Handle. In those cases you must call the method
|
---|
59 | Refresh (see below) to redraw it.
|
---|
60 | -->
|
---|
61 | </td>
|
---|
62 | <td class='default' valign='top' nowrap><br></td>
|
---|
63 | </tr>
|
---|
64 | <tr>
|
---|
65 | <td class='name' valign='top'>IconVisible</td>
|
---|
66 | <td class='desc' valign='top'><span class='declaration'>property IconVisible: Boolean;</span><br>
|
---|
67 | Whether to display the icon. This property has no effect in design mode.</td>
|
---|
68 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
69 | </tr>
|
---|
70 | <tr>
|
---|
71 | <td class='name' valign='top'>Hint</td>
|
---|
72 | <td class='desc' valign='top'><span class='declaration'>type THintString = ShortString;<br>
|
---|
73 | property Hint: THintString;</span><br>
|
---|
74 | The tray icon's hint (max 128 chars), which is displayed when you move the mouse cursor
|
---|
75 | over the tray icon. Use #13 as a separator in multi-line hints.<br>
|
---|
76 | <b>NOTE:</b> WinNT doesn't appear to support multi-line hints.<br>
|
---|
77 | <b>NOTE:</b> On some older Windows versions (before IE 5) the hint is max 64 chars.<br>
|
---|
78 | <b>NOTE:</b> The time until the hint window closes is determined by Windows,
|
---|
79 | so don't bother trying to change the interval, because you can't. Setting
|
---|
80 | Application.HintPause and Application.HintHidePause has no effect.
|
---|
81 | </td>
|
---|
82 | <td class='default' valign='top' nowrap><br></td>
|
---|
83 | </tr>
|
---|
84 | <tr>
|
---|
85 | <td class='name' valign='top'>ShowHint</td>
|
---|
86 | <td class='desc' valign='top'><span class='declaration'>property ShowHint: Boolean;</span><br>
|
---|
87 | Whether to show the hint.</td>
|
---|
88 | <td class='default' valign='top' nowrap>Default true</td>
|
---|
89 | </tr>
|
---|
90 | <tr>
|
---|
91 | <td class='name' valign='top'>PopupMenu</td>
|
---|
92 | <td class='desc' valign='top'><span class='declaration'>property PopupMenu: TPopupMenu;</span><br>
|
---|
93 | The popup menu you want to display when the icon is clicked.</td>
|
---|
94 | <td class='default' valign='top' nowrap>Default true</td>
|
---|
95 | </tr>
|
---|
96 | <tr>
|
---|
97 | <td class='name' valign='top'>LeftPopup</td>
|
---|
98 | <td class='desc' valign='top'><span class='declaration'>property LeftPopup: Boolean;</span><br>
|
---|
99 | Whether you want the popup menu to pop up when you click the left mouse button.
|
---|
100 | Default is false, meaning only the right button will work.<br>
|
---|
101 | <b>NOTE:</b> LeftPopup must be false (or the popup menu unassigned) if you want to
|
---|
102 | double click the tray icon without displaying the popup menu.
|
---|
103 | LeftPopup must be false if you want CoolTrayIcon to handle a menu that has a default
|
---|
104 | menu item.</td>
|
---|
105 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
106 | </tr>
|
---|
107 | <tr>
|
---|
108 | <td class='name' valign='top'>Enabled</td>
|
---|
109 | <td class='desc' valign='top'><span class='declaration'>property Enabled: Boolean;</span><br>
|
---|
110 | Works like Enabled for other controls, enabling/disabling keyboard and mouse input.
|
---|
111 | Useful when you want to temporarily disable the popup menu, say while you are displaying
|
---|
112 | an about box or some other modal window.</td>
|
---|
113 | <td class='default' valign='top' nowrap>Default true</td>
|
---|
114 | </tr>
|
---|
115 | <tr>
|
---|
116 | <td class='name' valign='top'>IconList</td>
|
---|
117 | <td class='desc' valign='top'><span class='declaration'>property IconList: TCustomImageList;</span><br>
|
---|
118 | An ImageList containing icons. If it contains other images than icons, the tray icon
|
---|
119 | won't change when using CycleIcons, but no error occurs.<br>
|
---|
120 | <b>NOTE:</b> When you assign to IconList IconIndex is set to 0.<br>
|
---|
121 | <b>NOTE:</b> In D2 and D3 the property is of type TImageList in stead of TCustomImageList.</td>
|
---|
122 | <td class='default' valign='top' nowrap><br></td>
|
---|
123 | </tr>
|
---|
124 | <tr>
|
---|
125 | <td class='name' valign='top'>IconIndex</td>
|
---|
126 | <td class='desc' valign='top'><span class='declaration'>property IconIndex: Integer;</span><br>
|
---|
127 | The current icon in the assigned iconlist (or 0 if no iconlist is assigned).</td>
|
---|
128 | <td class='default' valign='top' nowrap><br></td>
|
---|
129 | </tr>
|
---|
130 | <tr>
|
---|
131 | <td class='name' valign='top'>CycleIcons</td>
|
---|
132 | <td class='desc' valign='top'><span class='declaration'>property CycleIcons: Boolean;</span><br>
|
---|
133 | Animates the tray icon by cycling through all the icons stored in IconList and assigning them
|
---|
134 | to Icon. When you set CycleIcons to true, it will begin with the first icon in IconList.<br>
|
---|
135 | <b>NOTE:</b> CycleIcons can be true even though you have no IconList.
|
---|
136 | No cycling will occur in that case, but the cycle timer is still active, which will consume
|
---|
137 | some resources.</td>
|
---|
138 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
139 | </tr>
|
---|
140 | <tr>
|
---|
141 | <td class='name' valign='top'>CycleInterval</td>
|
---|
142 | <td class='desc' valign='top'><span class='declaration'>property CycleInterval: Cardinal;</span><br>
|
---|
143 | The time interval in milisecs. before selecting a new icon from IconList.</td>
|
---|
144 | <td class='default' valign='top' nowrap><br></td>
|
---|
145 | </tr>
|
---|
146 | <tr>
|
---|
147 | <td class='name' valign='top'>DesignPreview</td>
|
---|
148 | <td class='desc' valign='top'><span class='declaration'>property DesignPreview: Boolean;</span><br>
|
---|
149 | Enables you to preview the tray icon in design mode. You can watch what the icon looks like,
|
---|
150 | see its hint, enable/disable it, test the popupmenu, and animate it via CycleIcons.<br>
|
---|
151 | <b>NOTE:</b> Set DesignPreview to false to avoid the design time icon appearing when you run
|
---|
152 | your program. This is only a problem in the Delphi IDE, not in the finished exe-file.
|
---|
153 | I couldn't find a way to kill the design icon in run-time, so you'll have to do it yourself.<br>
|
---|
154 | <b>NOTE:</b> Setting DesignPreview in run-time has no effect.</td>
|
---|
155 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
156 | </tr>
|
---|
157 | <tr>
|
---|
158 | <td class='name' valign='top'>Handle</td>
|
---|
159 | <td class='desc' valign='top'><span class='declaration'>property Handle: HWND;</span><br>
|
---|
160 | The tray icon's handle.</td>
|
---|
161 | <td class='default' valign='top' nowrap><br></td>
|
---|
162 | </tr>
|
---|
163 | <!--
|
---|
164 | <tr>
|
---|
165 | <td class='name' valign='top'>WindowHandle</td>
|
---|
166 | <td class='desc' valign='top'><span class='declaration'>property WindowHandle: HWND;</span><br>
|
---|
167 | The tray icon's window handle.</td>
|
---|
168 | <td class='default' valign='top' nowrap><br></td>
|
---|
169 | </tr>
|
---|
170 | -->
|
---|
171 | <tr>
|
---|
172 | <td class='name' valign='top'>WantEnterExitEvents</td>
|
---|
173 | <td class='desc' valign='top'><span class='declaration'>property WantEnterExitEvents: Boolean;</span><br>
|
---|
174 | Whether you would like to receive the OnMouseEnter and OnMouseExit events.
|
---|
175 | These events require an internal timer to be active, so if you have no use for them
|
---|
176 | set WantEnterExitEvents to false to minimize resource usage.</td>
|
---|
177 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
178 | </tr>
|
---|
179 | <tr>
|
---|
180 | <td class='name' valign='top'>Behavior</td>
|
---|
181 | <td class='desc' valign='top'><span class='declaration'>type TBehavior = (bhWin95, bhWin2000);<br>
|
---|
182 | property Behavior: TBehavior;</span><br>
|
---|
183 | This property does not affect the tray icon's behavior in any visible way.
|
---|
184 | It determines which messages are dispatched to the application when the user interacts
|
---|
185 | with the tray icon (specifically, right mouse clicks result in a WM_RBUTTONDOWN followed
|
---|
186 | by a WM_RBUTTONUP message in Win95 mode, but in Win2000 mode a WM_CONTEXTMENU, NIN_SELECT,
|
---|
187 | or NIN_KEYSELECT message is dispatched. For details, see the Remarks section on
|
---|
188 | <a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/Shell/reference/functions/shell_notifyicon.asp'>this page</a>).<br>
|
---|
189 | Probably the only case where you should consider changing the value of this property, is
|
---|
190 | when you send messages to the tray icon programmatically, using PostMessage or SendMessage.<br>
|
---|
191 | <b>NOTE:</b> This property is public, not published.</td>
|
---|
192 | <td class='default' valign='top' nowrap>Default bhWin95</td>
|
---|
193 | </tr>
|
---|
194 | <tr>
|
---|
195 | <td class='name2' valign='top'>MinimizeToTray</td>
|
---|
196 | <td class='desc' valign='top'><i>This property applies only when the owner of the
|
---|
197 | tray icon component is a form.</i><br>
|
---|
198 | <span class='declaration'>property MinimizeToTray: Boolean;</span><br>
|
---|
199 | Whether you want to hide the main form instead of minimizing it. The form will hide
|
---|
200 | and the tray icon will show.</td>
|
---|
201 | <td class='default' valign='top' nowrap>Default false</td>
|
---|
202 | </tr>
|
---|
203 | </table>
|
---|
204 |
|
---|
205 |
|
---|
206 |
|
---|
207 | <a name='Methods'></a><h2>Methods</h2>
|
---|
208 |
|
---|
209 | <table cellpadding='2' cellspacing='2' border='0' width='100%'>
|
---|
210 | <tr>
|
---|
211 | <td class='name' valign='top'>Refresh</td>
|
---|
212 | <td class='desc' valign='top'><span class='declaration'>function Refresh: Boolean;</span><br>
|
---|
213 | Redraws the tray icon.
|
---|
214 | <!--
|
---|
215 | May be necessary when changing the icon, depending on how you do it (see above).
|
---|
216 | -->
|
---|
217 | You probably don't need to ever call this method.
|
---|
218 | </td>
|
---|
219 | <td class='default' valign='top'>Returns true or false</td>
|
---|
220 | </tr>
|
---|
221 | <tr>
|
---|
222 | <td class='name' valign='top'>ShowBalloonHint</td>
|
---|
223 | <td class='desc' valign='top'><span class='declaration'>type TBalloonHintIcon = (bitNone, bitInfo, bitWarning, bitError);<br>
|
---|
224 | type TBalloonHintTimeOut = 10..60;<br>
|
---|
225 | function ShowBalloonHint(Title: String; Text: String; IconType: TBalloonHintIcon; TimeoutSecs: TBalloonHintTimeOut): Boolean;</span><br>
|
---|
226 | Shows a balloon hint (a kind of "sticky" popup hint).<br>
|
---|
227 | <b>NOTE:</b> Balloon hints are available in WinME, Win2000, and WinXP only.
|
---|
228 | Calling this method in other Windows versions has no effect.<br>
|
---|
229 | <b>NOTE:</b> You can use up to 64 chars for the title and up to 255 chars for the text.
|
---|
230 | The hint is visible for 10-60 seconds, or until the user clicks it (or until you
|
---|
231 | programmatically hide it). You cannot show a balloon hint if the tray icon is not showing,
|
---|
232 | and hiding the tray icon hides any balloon hint.<br>
|
---|
233 | <b>NOTE:</b> The HideBalloonHint method is automatically called by ShowBalloonHint,
|
---|
234 | so you don't get multiple balloon hints.</td>
|
---|
235 | <td class='default' valign='top'>Returns true or false</td>
|
---|
236 | </tr>
|
---|
237 | <tr>
|
---|
238 | <td class='name' valign='top'>HideBalloonHint</td>
|
---|
239 | <td class='desc' valign='top'><span class='declaration'>function HideBalloonHint: Boolean;</span><br>
|
---|
240 | Hides the balloon hint (if any).</td>
|
---|
241 | <td class='default' valign='top'>Returns true or false</td>
|
---|
242 | </tr>
|
---|
243 | <tr>
|
---|
244 | <td class='name' valign='top'>PopupAtCursor</td>
|
---|
245 | <td class='desc' valign='top'><span class='declaration'>procedure PopupAtCursor;</span><br>
|
---|
246 | Pops up the associated popupmenu (if any). This method is usually called automatically
|
---|
247 | in response to an OnClick event, but you can call it manually if you want the popupmenu
|
---|
248 | to appear at other times. The menu will appear at the current cursor coordinates.</td>
|
---|
249 | <td class='default' valign='top'><br></td>
|
---|
250 | </tr>
|
---|
251 | <tr>
|
---|
252 | <td class='name' valign='top'>BitmapToIcon</td>
|
---|
253 | <td class='desc' valign='top'><span class='declaration'>function BitmapToIcon(const Bitmap: TBitmap; const Icon: TIcon; MaskColor: TColor): Boolean;</span><br>
|
---|
254 | Renders and returns an existing icon based on the bitmap given as parameter.
|
---|
255 | The bitmap should be 16x16 pixels. Specify a color to be shown transparently or clNone
|
---|
256 | for no transparency.<br>
|
---|
257 | <b>NOTE:</b> Bitmaps that are not exactly 16x16 will be scaled up or down.</td>
|
---|
258 | <td class='default' valign='top'>Returns true or false</td>
|
---|
259 | </tr>
|
---|
260 | <tr>
|
---|
261 | <td class='name' valign='top'>GetTooltipHandle</td>
|
---|
262 | <td class='desc' valign='top'><span class='declaration'>function GetTooltipHandle: HWND;</span><br>
|
---|
263 | All tray icons share the same tooltip window (the hint popup).
|
---|
264 | This method returns the tooltip handle.</td>
|
---|
265 | <td class='default' valign='top'>Returns handle or 0 if error</td>
|
---|
266 | </tr>
|
---|
267 | <tr>
|
---|
268 | <td class='name' valign='top'>GetBalloonHintHandle</td>
|
---|
269 | <td class='desc' valign='top'><span class='declaration'>function GetBalloonHintHandle: HWND;</span><br>
|
---|
270 | All applications share the same balloon hint (if supported by the Windows version).
|
---|
271 | This method returns the balloon hint handle.</td>
|
---|
272 | <td class='default' valign='top'>Returns handle or 0 if error</td>
|
---|
273 | </tr>
|
---|
274 | <tr>
|
---|
275 | <td class='name' valign='top'>GetClientIconPos</td>
|
---|
276 | <td class='desc' valign='top'><span class='declaration'>function GetClientIconPos(X, Y: Integer): TPoint;</span><br>
|
---|
277 | Returns the cursor position <i>inside</i> the tray icon.
|
---|
278 | Will return coordinates between (-1,-1) and (16,16).
|
---|
279 | You would expect the coordinates to vary between 0 and 15, but Windows adds a border
|
---|
280 | 1 pixel wide to all tray icons, which is appparently considered to be part of the tray icons.
|
---|
281 | Depending on whether the tray icon has other tray icons as neighbours to the left, right,
|
---|
282 | top, or bottom, the border is inserted as Windows sees fit.
|
---|
283 | So in other words, <i>this method is not exact</i>. You should expect a variation of 2 pixels.
|
---|
284 | If anyone sees a way to patch this, let me know.</td>
|
---|
285 | <td class='default' valign='top'>Returns position in a TPoint</td>
|
---|
286 | </tr>
|
---|
287 | <tr>
|
---|
288 | <td class='name2' valign='top'>ShowMainForm</td>
|
---|
289 | <td class='desc' valign='top'><i>This method applies only when the owner of the
|
---|
290 | tray icon component is a form.</i><br>
|
---|
291 | <span class='declaration'>procedure ShowMainForm;</span><br>
|
---|
292 | Shows the main form.<br>
|
---|
293 | <b>NOTE:</b> It is important that you use this method when displaying the form,
|
---|
294 | as it contains important calls that affect how the form and the application display
|
---|
295 | themselves. See the demo app.</td>
|
---|
296 | <td class='default' valign='top'><br></td>
|
---|
297 | </tr>
|
---|
298 | <tr>
|
---|
299 | <td class='name2' valign='top'>HideMainForm</td>
|
---|
300 | <td class='desc' valign='top'><i>This method applies only when the owner of the
|
---|
301 | tray icon component is a form.</i><br>
|
---|
302 | <span class='declaration'>procedure HideMainForm;</span><br>
|
---|
303 | Hides the main form.</td>
|
---|
304 | <td class='default' valign='top'><br></td>
|
---|
305 | </tr>
|
---|
306 | <tr>
|
---|
307 | <td class='name2' valign='top'>ShowTaskbarIcon</td>
|
---|
308 | <td class='desc' valign='top'><i>This method applies only when the owner of the
|
---|
309 | tray icon component is a form.</i><br>
|
---|
310 | <span class='declaration'>procedure ShowTaskbarIcon;</span><br>
|
---|
311 | Shows the application's taskbar icon (not to be confused with the tray icon).<br>
|
---|
312 | <td class='default' valign='top'><br></td>
|
---|
313 | </tr>
|
---|
314 | <tr>
|
---|
315 | <td class='name2' valign='top'>HideTaskbarIcon</td>
|
---|
316 | <td class='desc' valign='top'><i>This method applies only when the owner of the
|
---|
317 | tray icon component is a form.</i><br>
|
---|
318 | <span class='declaration'>procedure HideTaskbarIcon;</span><br>
|
---|
319 | Hides the application's taskbar icon (not to be confused with the tray icon).<br>
|
---|
320 | <b>NOTE:</b> If you display a child form the taskbar icon will become visible again
|
---|
321 | automatically. This is standard Windows behavior.</td>
|
---|
322 | <td class='default' valign='top'><br></td>
|
---|
323 | </tr>
|
---|
324 | </table>
|
---|
325 |
|
---|
326 |
|
---|
327 |
|
---|
328 | <a name='Events'></a><h2>Events</h2>
|
---|
329 |
|
---|
330 | <table cellpadding='2' cellspacing='2' border='0' width='100%'>
|
---|
331 | <tr>
|
---|
332 | <td class='name' valign='top'>OnClick</td>
|
---|
333 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
334 | Works like the similar event for window controls.<br>
|
---|
335 | <b>NOTE:</b> The Click event corresponds to a MouseDown followed by a MouseUp.
|
---|
336 | If no DblClick event is assigned the Click event fires immediately (ie. after
|
---|
337 | the MouseUp). Otherwise it will wait for a small period of time to see if the
|
---|
338 | user clicks again, in which case we have a double click. If no DblClick event
|
---|
339 | is assigned a double click will actually cause the Click event to fire.
|
---|
340 | This is intentional.</td>
|
---|
341 | </tr>
|
---|
342 | <tr>
|
---|
343 | <td class='name' valign='top'>OnDblClick</td>
|
---|
344 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
345 | Works like the similar event for window controls.</td>
|
---|
346 | </tr>
|
---|
347 | <tr>
|
---|
348 | <td class='name' valign='top'>OnMouseDown</td>
|
---|
349 | <td class='desc' valign='top'><span class='declaration'>TMouseEvent;</span><br>
|
---|
350 | Works like the similar event for window controls.</td>
|
---|
351 | </tr>
|
---|
352 | <tr>
|
---|
353 | <td class='name' valign='top'>OnMouseUp</td>
|
---|
354 | <td class='desc' valign='top'><span class='declaration'>TMouseEvent;</span><br>
|
---|
355 | Works like the similar event for window controls.</td>
|
---|
356 | </tr>
|
---|
357 | <tr>
|
---|
358 | <td class='name' valign='top'>OnMouseMove</td>
|
---|
359 | <td class='desc' valign='top'><span class='declaration'>TMouseMoveEvent;</span><br>
|
---|
360 | Works like the similar event for window controls.</td>
|
---|
361 | </tr>
|
---|
362 | <tr>
|
---|
363 | <td class='name' valign='top'>OnMouseEnter</td>
|
---|
364 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
365 | Fired after the cursor enters the tray icon. Requires
|
---|
366 | the WantEnterExitEvents property to be true.</td>
|
---|
367 | </tr>
|
---|
368 | <tr>
|
---|
369 | <td class='name' valign='top'>OnMouseExit</td>
|
---|
370 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
371 | Fired after the cursor leaves the tray icon. Requires
|
---|
372 | the WantEnterExitEvents property to be true.</td>
|
---|
373 | </tr>
|
---|
374 | <tr>
|
---|
375 | <td class='name' valign='top'>OnCycle</td>
|
---|
376 | <td class='desc' valign='top'><span class='declaration'>procedure(Sender: TObject; NextIndex: Integer) of object;</span><br>
|
---|
377 | Fired just before the icon changes via CycleIcons.
|
---|
378 | Returns the next index in the assigned imagelist.</td>
|
---|
379 | </tr>
|
---|
380 | <tr>
|
---|
381 | <td class='name' valign='top'>OnBalloonHintShow</td>
|
---|
382 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
383 | Fired after the balloon hint shows itself. This doesn't have to occur immediately
|
---|
384 | after you call the ShowBalloonHint method. In case another application is already
|
---|
385 | showing a balloon hint, your application must wait for it to close before it gets
|
---|
386 | to show the balloon hint itself. This event will tell you when it has shown the hint.</td>
|
---|
387 | </tr>
|
---|
388 | <tr>
|
---|
389 | <td class='name' valign='top'>OnBalloonHintHide</td>
|
---|
390 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
391 | Fired after the balloon hint closes because another application needs to show a
|
---|
392 | balloon hint, or because you called either the ShowBalloonHint or the
|
---|
393 | HideBalloonHint method.</td>
|
---|
394 | </tr>
|
---|
395 | <tr>
|
---|
396 | <td class='name' valign='top'>OnBalloonHintTimeout</td>
|
---|
397 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
398 | Fired after the balloon hint closes because it timed out.</td>
|
---|
399 | </tr>
|
---|
400 | <tr>
|
---|
401 | <td class='name' valign='top'>OnBalloonHintClick</td>
|
---|
402 | <td class='desc' valign='top'><span class='declaration'>TNotifyEvent;</span><br>
|
---|
403 | Fired when the user clicks the balloon hint.</td>
|
---|
404 | </tr>
|
---|
405 | <tr>
|
---|
406 | <td class='name2' valign='top'>OnMinimizeToTray</td>
|
---|
407 | <td class='desc' valign='top'><i>This event applies only when the owner of the
|
---|
408 | tray icon component is a form.</i><br>
|
---|
409 | <span class='declaration'>TNotifyEvent;</span><br>
|
---|
410 | Fired when the application is about to minimize to tray. Useful if you want to do special
|
---|
411 | processing, like animation effects, when the app. gets minimized (hidden).<br>
|
---|
412 | <b>NOTE:</b> MinimizeToTray must be true for this event to fire.</td>
|
---|
413 | </tr>
|
---|
414 | <tr>
|
---|
415 | <td class='name2' valign='top'>OnStartup</td>
|
---|
416 | <td class='desc' valign='top'><i>This event applies only when the owner of the
|
---|
417 | tray icon component is a form.</i><br>
|
---|
418 | <span class='declaration'>procedure(Sender: TObject; var ShowMainForm: Boolean) of object;</span><br>
|
---|
419 | Fired initially at application startup when the main form is about to display.
|
---|
420 | Set the ShowMainForm parameter to false if you don't want the form to display.<br>
|
---|
421 | <b>NOTE:</b> May fire multiple times for an MDI form (once for every child form
|
---|
422 | created at startup).<br>
|
---|
423 | <b>NOTE:</b> This event occurs before the form's OnCreate method (if used with a form).<br>
|
---|
424 | <b>NOTE:</b> Replaces the StartMinimized property found in earlier versions.</td>
|
---|
425 | </tr>
|
---|
426 | </table>
|
---|
427 |
|
---|
428 |
|
---|
429 |
|
---|
430 | <a name='Hints'></a><h2>Hints</h2>
|
---|
431 |
|
---|
432 | <ul>
|
---|
433 | <li><b>How do I start my app. with the tray icon visible and the main form invisible?</b><br>
|
---|
434 | At design time set IconVisible to true and set the form's Visible property to false.
|
---|
435 | Set the ShowMainForm parameter to false in the OnStartup event. See the StartHidden demo.
|
---|
436 | </li>
|
---|
437 |
|
---|
438 | <li><b>What is the proper way to restore the form?</b><br>
|
---|
439 | ALWAYS use the method ShowMainForm! This method contains important calls that affect
|
---|
440 | how the form and the application display themselves. Simply setting the form visible
|
---|
441 | or calling Application.Restore is not enough. A common symptom is the form with tabpages
|
---|
442 | that don't update themselves because ShowMainForm wasn't used.
|
---|
443 | </li>
|
---|
444 |
|
---|
445 | <li><b>I used the OnStartup event to hide the form, but I can still see a quick flash on
|
---|
446 | the taskbar when the app. is starting?</b><br>
|
---|
447 | If it bothers you you can set the Application.ShowMainForm property in the main
|
---|
448 | project source, like this:
|
---|
449 | <pre> .....
|
---|
450 | Application.Initialize;
|
---|
451 | Application.ShowMainForm := False;
|
---|
452 | .....</pre>
|
---|
453 | </li>
|
---|
454 |
|
---|
455 | <li><b>Why does the tray icon not appear in my NT/2000/XP service app.?</b><br>
|
---|
456 | Set the service's Interactive property to true and set IconVisible to true.
|
---|
457 | See also the <a href='#Bugs'>bugs</a> section concerning services in NT4.
|
---|
458 | </li>
|
---|
459 |
|
---|
460 | <li><b>I want multiple tray icons in my app.?</b><br>
|
---|
461 | Just create a CoolTrayIcon object for each tray icon you want. The component is optimized
|
---|
462 | to share resources between the tray icons.
|
---|
463 | </li>
|
---|
464 |
|
---|
465 | <li><b>How do I send a message to the tray icon through code?</b><br>
|
---|
466 | Use PostMessage or SendMessage and specify the message as the LParam parameter.
|
---|
467 | Here's an example of sending a WM_LBUTTONDOWN message, invoking the tray icon's
|
---|
468 | OnMouseDown event:
|
---|
469 | <pre> PostMessage(CoolTrayIcon1.Handle, WM_TRAYNOTIFY, Integer(CoolTrayIcon1), WM_LBUTTONDOWN);</pre>
|
---|
470 | </li>
|
---|
471 |
|
---|
472 | <li><b>I want to hide ALL windows, including dialogs and popup forms?</b><br>
|
---|
473 | Minimize the app. before calling HideMainForm, like this:
|
---|
474 | <pre>
|
---|
475 | Application.Minimize;
|
---|
476 | CoolTrayIcon1.HideMainForm;</pre>
|
---|
477 | </li>
|
---|
478 |
|
---|
479 | <li><b>I want to override the "hide inactive tray icons" feature in WinXP?</b><br>
|
---|
480 | I don't know exactly how to do this, but try refreshing the tray icon at regular
|
---|
481 | intervals. Anyway, it's not a good idea to override standard Windows behavior.
|
---|
482 | </li>
|
---|
483 |
|
---|
484 | <li><b>When does the OnStartup event occur?</b><br>
|
---|
485 | The OnStartup event occurs before the owner form's OnCreate event.
|
---|
486 | </li>
|
---|
487 | </ul>
|
---|
488 |
|
---|
489 |
|
---|
490 |
|
---|
491 | <a name='Bugs'></a><h2>Known Bugs</h2>
|
---|
492 |
|
---|
493 | <ul>
|
---|
494 | <!--
|
---|
495 | <li>Someone complains the component's hint will not show when CycleIcons is true.
|
---|
496 | This happens in WinME. I've been unable to reproduce this error, but please tell me if
|
---|
497 | you get it.
|
---|
498 | </li>
|
---|
499 | -->
|
---|
500 | <!--
|
---|
501 | <li>CoolTrayIcon has previously had a bug that prevented the user from logging off
|
---|
502 | unless he manually terminated the application CoolTrayIcon was used in.
|
---|
503 | This should be fixed by now, but if not, please tell me.
|
---|
504 | </li>
|
---|
505 | -->
|
---|
506 | <li>The tray icon may disappear in NT4 if it is used in an interactive service and
|
---|
507 | you log off, then log back on. I've been trying to fix this, but have so far been
|
---|
508 | unsuccessful.
|
---|
509 | An explanation for why the problem occurs can be found
|
---|
510 | <a href='http://support.microsoft.com/default.aspx?scid=kb;EN-US;q238721'>here</a>.
|
---|
511 | (BTW: some service packs, like SP6 seem to fix this problem).
|
---|
512 | </li>
|
---|
513 |
|
---|
514 | <li>Some people report that the balloon hint events never fire. This is a Win2000 issue.
|
---|
515 | It doesn't appear to matter which service pack, Internet Explorer version, or comctl32.dll
|
---|
516 | version you use. This makes me suspect that Win2000 simply does not support these events.
|
---|
517 | </li>
|
---|
518 |
|
---|
519 | <li>Occasionally someone reports that an application using CoolTrayIcon prevents the
|
---|
520 | user from logging off or shutting down until he manually terminates the application.
|
---|
521 | I've more or less come to the conclusion that this is not a bug in CoolTrayIcon.
|
---|
522 | More likely it's a bug in some other third party component. At least it seems
|
---|
523 | people always get this error when they use CoolTrayIcon together with other
|
---|
524 | third party components. If you get this error try removing the other components
|
---|
525 | one at a time and see if that doesn't solve the problem (or even simpler - run my
|
---|
526 | demo app. and see if it has the problem). Afterwards, if you still have reason to
|
---|
527 | believe CoolTrayIcon is the problem, don't hesitate to tell me, but please perform
|
---|
528 | this simple test of exclusion first. (NOTE: It would seem various components in
|
---|
529 | Delphi's FastNet collection have this problem - independently of CoolTrayIcon).
|
---|
530 | <br><br>
|
---|
531 | Also make sure you use CoolTrayIcon correctly. If your app. "closes to tray"
|
---|
532 | (goes to the tray when the user clicks the form's close button) you need to handle
|
---|
533 | the WM_QUERYENDSESSION message manually, or the app. (unsurprisingly) won't terminate
|
---|
534 | when Windows shuts down. See the source in the CoolTrayTest demo for a solution.
|
---|
535 | </li>
|
---|
536 |
|
---|
537 | <li>One person has reported that the default icon that is created when you add a
|
---|
538 | CoolTrayIcon component to your application is invalid. You get a runtime error:
|
---|
539 | "Error reading CoolTrayIcon1.Icon.Data: The parameter is incorrect.".
|
---|
540 | I've not had anyone else report this, but please tell me if it happens to you.
|
---|
541 | To get around it, simply assign an icon to the Icon property.
|
---|
542 | </li>
|
---|
543 | </ul>
|
---|
544 |
|
---|
545 |
|
---|
546 |
|
---|
547 | <a name='Comments'></a><h2>Comments</h2>
|
---|
548 |
|
---|
549 | The CoolTrayIcon component is <i>freeware</i>. Feel free to use and improve it,
|
---|
550 | but <i>please include all original files if you redistribute the zip-file</i>.
|
---|
551 | If you have any comments or corrections to the component I would very much like
|
---|
552 | to hear them. A lot of Delphi programmers have already told me they like the
|
---|
553 | component and use it, which is a huge boost for my ego. Thanks a lot, guys -
|
---|
554 | especially those of you who gave suggestions and pointed out the bugs.
|
---|
555 | </p>
|
---|
556 |
|
---|
557 | <p>
|
---|
558 | If you use the component some credit somewhere in your app. would be a nice gesture,
|
---|
559 | but it is not a requirement.
|
---|
560 | </p>
|
---|
561 |
|
---|
562 | <p>
|
---|
563 | The component should work on any Windows platform (Win9x, ME, NT, 2000, XP).
|
---|
564 | If you experience any problems related to the operating system you use, please tell me.
|
---|
565 | Also, it should work in Delphi 3 and up (Delphi 2?) and C++Builder 3 and up.
|
---|
566 | Again, tell me if I'm wrong.
|
---|
567 | </p>
|
---|
568 |
|
---|
569 | <p>
|
---|
570 | <a name='Service'></a><b>A word about services:</b> CoolTrayIcon does not require its
|
---|
571 | owner to be a form. This allows you to use it for non-windowed apps. such as services.
|
---|
572 | Some of the properties, methods, and events don't make sense without a form, but rather
|
---|
573 | than creating a superclass without these properties/methods/events I've simply let them
|
---|
574 | stay in CoolTrayIcon itself. You can use them in your service app., but they will not do
|
---|
575 | anything. I figured the component would be more flexible and easier to extend into
|
---|
576 | subclasses this way.
|
---|
577 | </p>
|
---|
578 |
|
---|
579 | <p>
|
---|
580 | Get the latest version from <a href='http://www3.brinkster.com/troels/delphi.asp' target='_blank'>
|
---|
581 | http://www3.brinkster.com/troels/delphi.asp</a>.
|
---|
582 | </p>
|
---|
583 |
|
---|
584 | <p>
|
---|
585 | Troels Jakobsen<br>
|
---|
586 | <a href='mailto:delphiuser@get2net.dk'>delphiuser@get2net.dk</a>
|
---|
587 | </p>
|
---|
588 |
|
---|
589 | </body>
|
---|
590 | </html>
|
---|