How to Enable/Disable Pointer Repeat Events
This snippet shows how to Enable or Disable Repeated Pointer Events in Symbian C++.
S60 5th Edition
Repeat Pointer Events can be useful if you want some scrolling or some animation effect for your control, One of the basic Use Case for getting Pointer Repeat Events is for a scrollbar, so that holding down the pointer results in a continuous scroll.
Here we assume that we already have a working code for UI based Application.
The following capabilities and libraries are required:
CAPABILITY None LIBRARY cone.lib
Enabling Request for Pointer Repeat Event
For getting the Repeat Pointer Events, RWindowBase::RequestPointerRepeatEvent() can be used.
Note that the function RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 aTime, const TRect &aRect) instructs the window server to send a single pointer repeat event if the pointer state that caused the last event (e.g. EButton1Down) has not changed within aTime and the pointer has not moved outside aRect.
Inside the code that treats EButtonUp pointer event you must call RequestPointerRepeatEvent to set time interval between events and the rect where this event occurs.
// Do Something.
// EButton1Down was pressed, so now is the time to request for repeat events,
// so that we can get continuous repeat events, until pointer state changes.
Window().RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32 (20000), iRepeatRect);
// Its a repeat event, do whatever is required for eg: moving control in the direction
// of pointer position or perform some animation, or perform some calculations etc..
Disabling Pointer Repeat Event
For cancelling Pointer Repeat Events use RWindowBase::CancelPointerRepeatEventRequest();
Pointer Repeat Events are Enabled/Disabled.