×
Namespaces

Variants
Actions

使用动画DLL捕获按键事件

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
文章
翻译:
hoolee
最后由 hamishwillee 在 09 Aug 2012 编辑
  • 详细描述

动画DLL定义了一组多态DLL框架,用来处理动画。但是它也可以用来获得底层window server事件。


本文提供了一个方法,通过使用动画DLL捕捉底层事件。显示动画的示例在S60示例代码中有,但是未包含底层事件的处理。


所有的这些底层事件都可以通过MEventHandler::OfferRawEvent()接收和处理。这个方法需要在CAnim派生类中完成。函数将返回EFalse,此外后台程序或前台程序需要使用RWindowGroup::CaptureKey()捕捉按键事件。

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

当事件处理程序打开时,这些事件将送到MEventHandler::OfferRawEvent()方法中。可以通过调用MAnimGeneralFunctions::GetRawEvents(ETrue)函数完成。 一个对象的类MAnimGeneralFunctions()没有生成。这个类由window server完成,并提供了通过CAnim::iFunctions指针访问所有CAnim派生类的应用方法。因此为了接收到底层事件,需要增加下列代码到CAnim派生类的ConstructL()方法

void CImage::ConstructL( TAny* /*aArgs*/, TBool /*aHasFocus*/ )
{
iFunctions->GetRawEvents(ETrue);
}

Version Hint

Windows Phone: [[Category:Windows Phone]]
[[Category:Windows Phone 7.5]]
[[Category:Windows Phone 8]]

Nokia Asha: [[Category:Nokia Asha]]
[[Category:Nokia Asha Platform 1.0]]

Series 40: [[Category:Series 40]]
[[Category:Series 40 1st Edition]] [[Category:Series 40 2nd Edition]]
[[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]]
[[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]]
[[Category:Series 40 6th Edition (initial release)]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 Developer Platform 1.1]] [[Category:Series 40 Developer Platform 2.0]]

Symbian: [[Category:Symbian]]
[[Category:S60 1st Edition]] [[Category:S60 2nd Edition (initial release)]] [[Category:S60 2nd Edition FP1]] [[Category:S60 2nd Edition FP2]] [[Category:S60 2nd Edition FP3]]
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
[[Category:S60 5th Edition]]
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

This page was last modified on 9 August 2012, at 05:26.
155 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×