On 1/30/07, Eric Chapman <[EMAIL PROTECTED]> wrote:
I would certainly like this problem to be fixed. Whatever the GUI guidelines
may say, I find the present behaviour irritating, and so do users of my
program. I can't really see any practical problem for the user if the popup
menu is activated by the MouseUp event.
You are right. I hadn't looked with more depth about this problem
before because there hasn't been a release on my software that uses
tray icon in some months. But with a release approaching, I won't
release it with this bug =) (the bug is a regression introduced on a
patch I created on October). Plus, noone reported it ... for quite
some time I was unsure it existed, thinking it could be a local
problem
I think the final decision will be that, if Lazarus popup menus change
from mouse up to mouse down, then trayicon may change it's behavior.
Until then, it's better to follow the way lazarus does things (because
the different way didn't work =) )
Attached patch solves this.
thanks,
--
Felipe Monteiro de Carvalho
Index: components/trayicon/wsgtk2trayicon.pas
===================================================================
--- components/trayicon/wsgtk2trayicon.pas (revision 10535)
+++ components/trayicon/wsgtk2trayicon.pas (working copy)
@@ -217,8 +217,13 @@
2: if Assigned(vwsTrayIcon.OnMouseUp) then
vwsTrayIcon.OnMouseUp(vwsTrayIcon, mbMiddle, [], Round(event^.X), Round(event^.Y));
- 3: if Assigned(vwsTrayIcon.OnMouseUp) then
- vwsTrayIcon.OnMouseUp(vwsTrayIcon, mbRight, [], Round(event^.X), Round(event^.Y));
+ 3:
+ begin
+ if Assigned(vwsTrayIcon.OnMouseUp) then
+ vwsTrayIcon.OnMouseUp(vwsTrayIcon, mbRight, [], Round(event^.X), Round(event^.Y));
+ if Assigned(vwsTrayIcon.PopUpMenu) then
+ vwsTrayIcon.PopUpMenu.PopUp(Mouse.CursorPos.X, Mouse.CursorPos.Y);
+ end;
end;
end;
@@ -250,15 +255,10 @@
vwsTrayIcon.OnMouseDown(vwsTrayIcon, mbLeft, [], Round(event^.X), Round(event^.Y));
2: if Assigned(vwsTrayIcon.OnMouseUp) then
- vwsTrayIcon.OnMouseDown(vwsTrayIcon, mbMiddle, [], Round(event^.X), Round(event^.Y));
+ vwsTrayIcon.OnMouseDown(vwsTrayIcon, mbMiddle, [], Round(event^.X), Round(event^.Y));
- 3:
- begin
- if Assigned(vwsTrayIcon.OnMouseUp) then
- vwsTrayIcon.OnMouseDown(vwsTrayIcon, mbRight, [], Round(event^.X), Round(event^.Y));
- if Assigned(vwsTrayIcon.PopUpMenu) then
- vwsTrayIcon.PopUpMenu.PopUp(Mouse.CursorPos.X, Mouse.CursorPos.Y);
- end;
+ 3: if Assigned(vwsTrayIcon.OnMouseUp) then
+ vwsTrayIcon.OnMouseDown(vwsTrayIcon, mbRight, [], Round(event^.X), Round(event^.Y));
end;
end;
end;