On 25.08.2006 07:44, James Liggett wrote:
- icon->tooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
icon->window, NULL, NULL, NULL);
Hm, wouldn't it be more economic to try to use one tooltip for all icons?
-f.r.
On Fri, 2006-08-25 at 20:19 +0200, Frank Richter wrote:
Hm, wouldn't it be more economic to try to use one tooltip for all icons? From a purely memory-consumption standpoint, yes. But there are still
issues with that. One is that we'd have to handle every mouse event to see where the cursor is to make sure the tooltip had the right text for the right icon. Second is the window-rectangle issue. the problem is that once a tray docks our icon, we basically don't own it, so we don't know exactly what the tray is going to do with it, and thus we don't know exactly where the window is going to be, and I don't see a viable way to find out. Thus, we need to have one tooltip per icon window for this to work. In fact, there's a small bug in my submitted patch. If you use it, start one program that uses a tray icon. Then start another program that uses an icon. Close out the first program so that only the second icon is left in the tray. You'll notice that the tooltip for this remaining icon doesn't work anymore, because the window's rectangle changed behind Explorer's back. My current solution is to associate tooltips with whole windows (using the TTF_IDISHWND flag in the TTTOOLINFO.uFlags parameter) instead of rectangular areas. This way, icons' tooltips continue to function even if their positions in the tray are changed.
So, to sum up: we can't use one tooltip for every icon ;-)
James
On 25.08.2006 21:10, James Liggett wrote:
On Fri, 2006-08-25 at 20:19 +0200, Frank Richter wrote:
Hm, wouldn't it be more economic to try to use one tooltip for all icons? From a purely memory-consumption standpoint, yes. But there are still
issues with that. One is that we'd have to handle every mouse event to see where the cursor is to make sure the tooltip had the right text for the right icon.
AFAICS tooltip can contain multiple "tools". Each tool is given a rectangle. So perhaps make one tool per icon, with matching rectangle?
Second is the window-rectangle issue. the problem is
that once a tray docks our icon, we basically don't own it, so we don't know exactly what the tray is going to do with it, and thus we don't know exactly where the window is going to be, and I don't see a viable way to find out.
Is there no way to get notifications of window movements? At any rate, getting right rectangles seems crucial for tooltips to work properly.
Thus, we need to have one tooltip per icon window for
this to work. In fact, there's a small bug in my submitted patch. If you use it, start one program that uses a tray icon. Then start another program that uses an icon. Close out the first program so that only the second icon is left in the tray. You'll notice that the tooltip for this remaining icon doesn't work anymore, because the window's rectangle changed behind Explorer's back. My current solution is to associate tooltips with whole windows (using the TTF_IDISHWND flag in the TTTOOLINFO.uFlags parameter) instead of rectangular areas. This way, icons' tooltips continue to function even if their positions in the tray are changed.
How does the tooltip track the correct rect then? If it can do it, you can, too.
-f.r.
On Fri, 2006-08-25 at 21:45 +0200, Frank Richter wrote:
AFAICS tooltip can contain multiple "tools". Each tool is given a rectangle. So perhaps make one tool per icon, with matching rectangle?
Yeah, they can do that. That's the easy part. The hard part is just managing the whole thing. Right now the individual tooltip controls do that for us.
Second is the window-rectangle issue. the problem is
that once a tray docks our icon, we basically don't own it, so we don't know exactly what the tray is going to do with it, and thus we don't know exactly where the window is going to be, and I don't see a viable way to find out.
Is there no way to get notifications of window movements? At any rate, getting right rectangles seems crucial for tooltips to work properly.
I'm sure there is, but I can't tell offhand if we get the right messages or not. Besides, this still brings up the management problem. If we wanted to use just one tooltip for all of our icons, we'd have to do a lot more work for really not much of a benefit that I can see.
James