Search the Community
Showing results for tags 'swipe'.
Found 2 results
Every now and then I read something so refreshing, that it jolts the old braincells out of its rut. 10/GUI describes a new gui system concept which does away with keyboards and mice, relying on gestures instead Fun, and somehow very convincing Recently I needed a mechanism to cycle through an image carousel. There are different ways of doing this, but for touch enabled devices I opted for a one-finger swipe gesture. W3Image.OnSwipeLeft := procedure(sender: TObject) begin ... end; The implementation of OnSwipeLeft below is somewhat project specific, but includes the following - it is made a property of all customcomponents descendants (helper construct) - it extends TNotifyEvent, so it does not only return the sending object (sender: TObject), but also the event object (event: variant). That way OnSwipeLeft has access to properties of both (and handles all event-types) - it checks if the device has touch capabilities and uses the touch-api if that is the case, otherwise it uses pointerevents Demo project (covering all swipe orientations. Verbose code, can be simplified) The touch-api supports multi-touch events to a certain maximum. My phone can handle 5 fingers. That makes it possible to implement for instance two-finger swipes to slide-in the next form. Form.OnFormSwipeRight := lambda Application.GotoForm('Form2', feFromRight); end;
just for reference : I'm using the SmartCL.Controller.Swipe controller to enable swiping I noticed that on Android phones I need to change the default parameters to something like constructor TW3SwipeController.Create(const AOwner:TW3TagObj); begin inherited Create(AOwner); FHRange:=TW3SwipeRange.Create(20,90); // [min]---X---[max] //20-40 FVRange:=TW3SwipeRange.Create(20,90); // [min]---Y---[max] //20-40 Latency := 55; //35 Options := ; //[coStrictTarget]; end; otherwise it wouldn't detect a swipe reliably I'll do some more testing on different touch-enabled hardware platforms edited: the controller has read-only properties for these parameters