distinguish between left and right mouse button in double click event? lazarus / 31-LCL ---------------------------------------------------------------------- marunguy · 2013-08-09 03:45 Hi! How can I distinguish between left and right mouse button in double click event? Double click event can be processed in OnDblClick event. But, it cannot distinguish between left and right mouse button. Quoteprocedure TFormMain.TrayIconMainDblClick(Sender: TObject); begin   ShowMessage('double click'); // left, right mouse button ?? end; I try to process in OnMouseUp event with ssDouble. ssDouble in Shift not set and I cannot process the left mouse button double click event. OnMouseDown is same. Quoteprocedure TFormMain.TrayIconMainMouseUp(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   if mbRight = Button then     ShowMessage('right click')   else if (mbLeft = Button) and (ssDouble in Shift) then   begin     ShowMessage('left double click');  // no executed!!!.   end; end; ---------------------------------------------------------------------- JuhaManninen · 2013-08-09 12:55 Quote from: marunguy on August 09, 2013, 05:45:13 amHow can I distinguish between left and right mouse button in double click event? Right double click is not a standard event anywhere AFAIK. Double click is composed of 2 single clicks, thus you will not see it in a MouseUp event. You must build the logic somehow yourself for this new event. ---------------------------------------------------------------------- marunguy · 2013-08-10 04:14 Hi! I understand that Double Click event is processed in OnMouseDown event. For TTrayIcon, both left and right double click actions call the OnDblClick(). For TPanel, only left double click action call the OnDblClick() unlike TTrayIcon. Below code with TPanel works fine for me. Code: [Select]procedure TFormMain.Panel1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   if ssDouble in Shift then   begin     if ssLeft in Shift then       ShowMessage('Panel Left Double')     else if ssRight in Shift then       ShowMessage('Panel Right Double');   end; end; ---------------------------------------------------------------------- JuhaManninen · 2013-08-10 07:05 Quote from: marunguy on August 10, 2013, 06:14:15 amFor TTrayIcon, both left and right double click actions call the OnDblClick(). For TPanel, only left double click action call the OnDblClick() unlike TTrayIcon. Ok, my knowledge of LCL and widgetsets is limited. What you explained sounds inconsistent. Maybe somebody more knowledgeable can comment. ---------------------------------------------------------------------- ChrisF · 2013-08-10 13:09 It seems that the TShiftState parameter is incorrectly built in Lazarus (and it's not specific to the TTrayIcon component); it's different in Delphi. Anyway, here is a possible solution: -use the DblClick and the MouseDown events of the TTrayIcon component -keep the last button used in MouseDown -process DblClick event using the last button used Hereafter just the implementation part of the unit code for such a sample: Code: [Select] ... implementation {$R *.lfm} { TForm1 } var   LastButton: TMouseButton; procedure TForm1.TrayIcon1DblClick(Sender: TObject); begin   if LastButton=mbLeft then     ShowMessage('Double Left Click')   else     if LastButton=mbRight then       ShowMessage('Double Rigth Click'); end; procedure TForm1.TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   LastButton:=Button; end; ... ---------------------------------------------------------------------- JuhaManninen · 2013-08-12 09:56 Quote from: ChrisF on August 10, 2013, 03:09:54 pmIt seems that the TShiftState parameter is incorrectly built in Lazarus (and it's not specific to the TTrayIcon component); it's different in Delphi. Could you please create a bug report with example code demonstrating the error. If you can find a way to fix it in LCL code, still better of course. Juha ---------------------------------------------------------------------- ChrisF · 2013-08-12 22:01 Quote from: JuhaManninen on August 12, 2013, 11:56:00 amCould you please create a bug report... IMHO, it's not really a bug.