The following examples demonstrate how to process window-related event types, which are events local to specific windows and include pointer events.
Variant : ScreenPlay and non-ScreenPlay . Target audience : Application developers.
To detect if a pointer event has been issued, use the EEventPointerEnter , EEventPointerExit , EEventPointer and EEventDragDrop event types.
You can request information about the pointer event type by calling the TWsEvent::Pointer() function.
// Pointer events case EEventPointer: case EEventDragDrop: { // Gets the pointer position TPointerEvent& pointerEvent = *iWsEvent.Pointer(); TPoint point = pointerEvent.iPosition; break; }
To detect whether pointer events are ready to retrieve from a buffer, use the EEventPointerBufferReady event type.
The RWindowBase::EnablePointerMoveBuffer() function instructs the Window Server to begin putting pointer events into the pointer move buffer.
You can get the buffer containing the stored pointer events by calling RWindowBase::RetrievePointerMoveBuffer() .
// Pointer events are ready to retrieve from a buffer case EEventPointerBufferReady: { const TInt KPointerMoveBufferSize = 20; // Gets the window RWindow* window = (RWindow*)(iWsEvent.Handle()); // Set up an array of TPoints into which to read the buffer TPoint pnts[KPointerMoveBufferSize]; TPtr8 ptr((TUint8 *)&pnts;,sizeof(pnts)); TInt numPts = window -> RetrievePointerMoveBuffer(ptr); break; }
Note that the way to map the handle to a window depends on the environment that you are working in, usually this will be the UI Control Framework which will have to do this mapping a different way.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.