Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Capturing key events using Animation dll

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Tested on Nokia N95,
Navi 6210,
Nokia 5800 XpressMusic
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 5th Edition
Nokia Belle
Symbian Anna
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
Keywords: Animation dll, CAnim, RAnim, raw events
Created: User:Technical writer 1 (25 Feb 2009)
Last edited: hamishwillee (30 May 2013)


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*/ )
This page was last modified on 30 May 2013, at 04:37.
58 page views in the last 30 days.