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
Nokia 5800 XpressMusic
S60 3rd Edition, FP2
S60 5th Edition
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
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
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*/ )