Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6234651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:31:28+00:00 2026-05-24T10:31:28+00:00

We use mouse left click to trigger actions in menu items of TPopupMenu. How

  • 0

We use mouse left click to trigger actions in menu items of TPopupMenu. How to trigger different action on mouse middle click in these menu items? In other word, mouse left and middle click on TPopupmenu’s menu items are both different action.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:31:29+00:00Added an answer on May 24, 2026 at 10:31 am

    I try to combine 2 answers from author NGLN and come out with the following.

    Define a new class inherit from TPopupList:

    TMyPopupList = class(TPopupList)
    protected
      procedure WndProc(var Message: TMessage); override;
    end;
    
    procedure TMyPopupList.WndProc(var Message: TMessage);
    var H: HWND;
    begin
      case Message.Msg of
        WM_MBUTTONDOWN: begin
          H := FindWindow(PChar('#32768'), nil);
          SendMessage(H, WM_IME_KEYDOWN, VK_RETURN, 0);
        end;
      end;
      inherited WndProc(Message);
    end;
    
    initialization
      PopupList.Free;
      PopupList := TMyPopupList.Create;
    end.
    

    The Item1Click is an OnClick event handler of TMenuItem that perform based on mouse click:

    procedure TForm1.Item1Click(Sender: TObject);
    begin
      if (GetKeyState(VK_MBUTTON) and $80 > 0) then
        Caption := 'Middle Click'
      else
        Caption := 'Normal Click';
    end;
    

    Note: #32768 is the default window class name for a pop-up menu, see MSDN documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to use a mouse click and drag in wpf? I
I would like have three mouse actions over a control: left, right and BOTH.
At the moment I'm trying to use Python to detect when the left mouse
Intro For a simple test tool recorder, how to capture left mouse click in
I would like to detect mouse events like left button click, right button click
I would like to use the middle mouse button to drag an image in
Much of the time when I use the mouse to click on an emacs
I need a rollover popup based on mouse click location (I cannot exactly use
I have a scrollable div tag (overflow). Now I'd like to use mouse to
I want to use the mouse scrollwheel in my OpenGL GLUT program to zoom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.