Delphi 如何在FireMonkey 中检测鼠标滚轮按钮是向上还是向下?

Delphi how to detect if mouse wheel button is up or down in FireMonkey?

在 VCL 中,有检测鼠标滚轮按钮何时弹起或按下的事件。有什么方法可以在 FireMonkey 中检测到此事件(对于 WindowsIOS 应用程序)?我在 Delphi's Help 找不到任何帮助,也没有在网上搜索。我在 Whosebug 进行了搜索,但没有找到任何与此主题相关的内容。谢谢。

现代鼠标上的滚轮已取代中间按钮。 FireMonkey 事件在这方面与 VCL 事件完全相同。只需测试所涉及的中间按钮。例如:

procedure TMyForm.FormMouseDown(Sender: TObject; 
                                Button: TMouseButton; 
                                Shift: TShiftState; 
                                X, Y: Single);
begin
  if Button = TMouseButton.mbMiddle then
  begin
    // The middle button (scroll wheel) was pressed down
  end;
end;

以上代码假定您使用枚举类型名称前缀进行编码。如果不是那么显然你不需要限定 mbMiddle.

这应该适用于 Windows 和 OS X/mac OS 应用程序。这如何或是否完全适用于 iOS(你提到的)或 Android 我不能说,但我怀疑它。