[英]How to disable FMX ComboBox Mouse Wheel scroll
How can I disable the mouse wheel scroll on a FMX TComboBox when hovering over it?将鼠标悬停在 FMX TComboBox 上时,如何禁用鼠标滚轮滚动? I've tried overriding the MouseWheel
method without any luck.我试过重写MouseWheel
方法,但没有任何运气。 I'm most likely doing it wrong as I'm not experienced with overriding.我很可能做错了,因为我没有覆盖的经验。 REF: MouseWheel REF: 鼠标滚轮
I've gone ahead and removed Inherited
:我已经继续并删除了Inherited
:
type
TComboBoxOverride = class(TComboBox)
procedure MouseWheel(Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); override;
end;
// I've tried changing the control on the class overriding the method. No luck
cbbServerMap: TComboBoxOverride;
{ TComboBoxOverride }
procedure TComboBoxOverride.MouseWheel(Shift: TShiftState; WheelDelta: Integer;
var Handled: Boolean);
begin
Handled := True;
end;
I've found the following SO post for VCL and DevEx but I'm struggling to convert it to FMX, Ref: How to suppress mouse wheel in TcxComboBox我找到了以下针对 VCL 和 DevEx 的 SO 帖子,但我正在努力将其转换为 FMX,参考: How to suppress mouse wheel in TcxComboBox
When setting a breakpoint on the TCustomComboBox.MouseWheel
method I can see that it ignores my override.在TCustomComboBox.MouseWheel
方法上设置断点时,我可以看到它忽略了我的覆盖。
In the OnMouseWheel
event, simply put Abort;
在OnMouseWheel
事件中,简单地放置Abort;
. .
For example:例如:
procedure TfrmMinorInjury.cboDischargetypeMouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
begin
Abort;
end;
I solved the same task but for memos in scrollbox.我解决了相同的任务,但滚动框中的备忘录。
My solution is我的解决方案是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.