Namespaces
Variants
Actions

Capturing key events using Animation dll

Jump to: navigation, search
Article Metadata

Tested with
Devices(s): Tested on Nokia N95,
Navi 6210,
Nokia 5800 XpressMusic

Compatibility
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 5th Edition

Article
Keywords: Animation dll, CAnim, RAnim, raw events
Created: User:Technical writer 1 (25 Feb 2009)
Last edited: hamishwillee (09 Aug 2012)

Overview

An animation DLL defines a framework for polymorphic DLLs that perform animations. However, it can also be used to get the raw window server events.

This article provides an additional aspect of capturing raw events using an animation DLL. The animation example already present in S60 examples does not include code for raw event handling.

All the raw events can be received and handled in MEventHandler::OfferRawEvent(). This function is implemented in an CAnim-derived class. This function should return EFalse, otherwise the foreground application or applications that have registered to get key events using RWindowGroup::CaptureKey() will not receive them.

 TBool CImage::OfferRawEvent( const TRawEvent& aRawEvent )
{
// To capture Zero key press
if(aRawEvent.Type()==TRawEvent::EKeyDown && aRawEvent.ScanCode()=='0')
{
// Event handling code
}
return EFalse;
}

These events are offered to MEventHandler::OfferRawEvent() only if raw event handling is switched on. This is done by calling MAnimGeneralFunctions::GetRawEvents(ETrue). An object of class MAnimGeneralFunctions is not created. The class is implemented by the window server and provides utility functions to all CAnim-derived classes via CAnim::iFunctions pointer. So in order to receive raw events, add the following code to ConstructL of the CAnim-derived class:

 void CImage::ConstructL( TAny* /*aArgs*/, TBool /*aHasFocus*/ )
{
iFunctions->GetRawEvents(ETrue);
}
This page was last modified on 9 August 2012, at 05:26.
142 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved