Prevent firing events while scrolling TVertScrollBox


Normally, while scrolling the contents of a “scroll box”, no event functions are fired from the sub-components of a scroll box, e. g. in native apps. But in FireMonkey, if a TVertScrollBox contains sub-elements like TRectangle (which I want to use as menu entries for a custom menu), scrolling the TVertScrollBox on Android with a finger sometimes triggers the event functions (like OnClick) of the sub-elements and this is very confusing for me and our customers – They don’t want to tap a specific element while scrolling.

In native apps this never happens. I couldn’t figure out how to prevent this behaviour. I tried to set the HitTest property to FALSE for all sub-elements in the OnMouseEnter and OnMouseLeave (I also tried other events) with something like this:

procedure TframeCornerMenu.VertScrollBox1MouseEnter(Sender: TObject);
list: TRectangle;
i: Integer;
list := FindComponent(‘rectMenuList’) as TRectangle;
for i := 0 to list.ChildrenCount – 1 do
if list.Children[i] is TRectangle then
TRectangle(list.Children[i]).HitTest := false;

But this obviously doesn’t (and can’t) work, because the user taps the sub-elements first which are lying on top of the TVertScrollBox.

Is this a bug / not implemented feature in FireMonkey? I appreciate all ideas solving this scrolling problem. If possible, without third-party components.

I am using Delphi Community Edition 10.3.2 (26.0.34749.6593).

Comments are closed.