Hi, I am developing a custom fmx list with a scroll bar. I found that the interactive pan gesture event is handled differently between windows and ios. In the ios flag, TInteractiveGestureFlag.gfInertia is not set for an inertia event; the absence of the gfBegin and gfEnd flags indicates an inertia event.
fvscroll is a standard scrollbar component.
scmfx, scmfy - private class variables TopItem sets the top of my custom list ItemHeight is the height of the list item.
procedure TFCListBox.FlickScroll(const Ev: TGestureEventInfo); var N:TDateTime; dy,dx,dz,rad:single; begin if TInteractiveGestureFlag.gfBegin in ev.flags then begin PanStartTime := N; PanStartEv := Ev; scrollstart := fvscroll.value; rad := DegToRad(RotationAngle); scmfx := sin(rad); scmfy := cos(rad); end; if (TInteractiveGestureFlag.gfInertia in ev.Flags) or (ev.Flags = []) then begin dy := (Ev.Location.Y - PanStartEv.Location.y) *scmfy; dx := (Ev.Location.X - PanStartEv.Location.X) *scmfx; dz := dx - dy; fvscroll.Value := scrollstart + dz; end; if TInteractiveGestureFlag.gfEnd in ev.Flags then begin TopItem := Round(fvScroll.Value/ItemHeight);} end; end;
I hope this is helpful
source share