Firemonkey how to add longTap gesture to runtime made ListBoxItems


I’m using Delphi 10 Seattle to build a multi device project with firemonkey.

My project has a ListBox, and I fill it runtime with ListBoxItems. I want to add the LongTap gesture to the ListBoxItems.

I have already tried this:

gestureManager := TGestureManager.Create(nil);
listBoxItem.Touch.GestureManager := gestureManager;
listBoxItem.Touch.InteractiveGestures := [TInteractiveGesture.LongTap];
listBoxItem.OnGesture := ListBoxItemGesture;

But the onGesture method doesn’t get called. If I add the gestureManager to the Form in the designer and call the same onGesture method it does get called.

Comments are closed.