Recent

Author Topic: TMenuItem - right click handling  (Read 372 times)

avmaksimov

  • Newbie
  • Posts: 2
TMenuItem - right click handling
« on: December 13, 2020, 04:53:58 pm »
Hello! To everyone. I'm nooby in Lazarus, but not in Delphi. But I don't understand how I can do handle for right click and may be later: middle click for TMenuItem.

Code from Delphi doesn't work and I tried to do TMyMenuItem with "procedure WMRButtonUp(var Message: TLMRButtonUp); message LM_RBUTTONUP;". But it doesn't help.

May be somebody bumped with this task.

jamie

  • Hero Member
  • *****
  • Posts: 4214
Re: TMenuItem - right click handling
« Reply #1 on: December 13, 2020, 06:06:35 pm »
not sure what your main interest is here but that seems to only work while the mouse pointer is within the form.

For anything outside the form client's area it would be the Non-Client so a WM_NCRBUTTONUP..

However, there are some areas with the LCL that blocks what is considered non useable messages for a TFORM. Its not like Delphi where all messages are pipped through and finish with the default procedure.

 You can however, hook the window procedure to capture all of it.
The only true wisdom is knowing you know nothing

avmaksimov

  • Newbie
  • Posts: 2
Re: TMenuItem - right click handling
« Reply #2 on: December 13, 2020, 07:01:15 pm »
Thank you for your answer, but I want to show popupmenu from my tray icon and for each menuitem do some action for left click and another for right.

And I want to create program for Win and Linux too. So I think you way is for Windows. But BTW I couldn't use it. I wrote "procedure Test(var Message: TLMNCHITTEST); message WM_NCRBUTTONUP;" for TForm.

 

TinyPortal © 2005-2018