×
Namespaces

Variants
Actions

How to Enable/Disable Pointer Repeat Events

From Nokia Developer Wiki
Jump to: navigation, search

This snippet shows how to Enable or Disable Repeated Pointer Events in Symbian C++.

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic.
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
Keywords: TPointerEvent::EButtonRepeat, Pointer Repeat Events, HandlePointerEventL().
Created: vasant21 (30 Nov 2008)
Last edited: hamishwillee (08 Feb 2012)

Contents

Overview

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.

Preconditions

Here we assume that we already have a working code for UI based Application.

MMP file

The following capabilities and libraries are required:

CAPABILITY  None
LIBRARY cone.lib 
include <COECNTRL.H>


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.

 switch (aPointerEvent.iType)
{
case TPointerEvent::EButton1Down:
{
// 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);
break;
}
case TPointerEvent::EButtonRepeat:
{
// 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..
break;
}

Disabling Pointer Repeat Event

For cancelling Pointer Repeat Events use RWindowBase::CancelPointerRepeatEventRequest();


Postconditions

Pointer Repeat Events are Enabled/Disabled.

This page was last modified on 8 February 2012, at 08:14.
37 page views in the last 30 days.
×