Home > Software engineering >  How to avoid invoking the Popup Menu of a control when Shift Ctrl-double-clicking it?
How to avoid invoking the Popup Menu of a control when Shift Ctrl-double-clicking it?

Time:12-14

In a Delphi 11 VCL Application with a TPanel control in Windows 10, the PopupMenu property of the Panel has a TPopupMenu assigned. When DOUBLE-CLICKING the Panel control at run-time while pressing the SHIFT CONTROL keys, the POPUPMENU of the Panel is invoked! How can I avoid invoking the Popup menu in this case and execute my own action instead?

procedure TForm1.PanelDblClick(Sender: TObject);
begin
  if (GetKeyState(VK_SHIFT) < 0) and (GetKeyState(VK_CONTROL) < 0) then
  begin
    // Does not work - the PopupMenu is always invoked:
    ShowMessage('The SHIFT CONTROL keys are being pressed.');
  end;
end;

CodePudding user response:

Parallels desktop has an alternate way to right click to support a single button mouse. The running VM will only see the right click when this is used.

So your Windows VM is currently receiving two right clicks which it passes on to your Delphi VCL Application.

Ref: enter image description here

  • Related