Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Symbian^3 Kinetic Scrolling (Chinese)

From Wiki
Jump to: navigation, search
Article Metadata

代码示例
文章
Levin_Wei 在 10 May 2010 创建
最后由 hamishwillee 在 30 May 2013 编辑

Kinetic Scrolling已经是N97与N97mini设备上已有的功能,现在,该功能已经成为Symbian平台上的一部分。该功能是基于Open Source ODE的,而且任何使用Avkon框架的应用,在不修改代码的情况下就可以获得该功能。下面会给出使用kinetic Scrolling功能的Avkon控件的例子。在所有的S60 Avkon控件中,只要有滚动条功能的控件,现在都拥有Kinetic Scrolling功能,包括lists、grids、forms和option menus。

但是这里有两条规则需要遵循:
1.不要对任何滚动条控件的状态做假设,不要主动去查询该控件的状态,而是等待该控件回调通知你的应用。

Bad Code

void CMyContainer::HandlePointerEventL(const TPointerEvent& aEvent)
{
TInt oldCurrentItem = iListBox->CurrentItemIndex();
...
CCoeControl::HandlePointerEventL(aEvent);//pass event to child controls
if(iListBox->CurrentItemIndex() != oldCurrentItem)
{
...
}
...
}

Good Code:

void CMyContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
{
...
if(iListBox->CurrentItemIndex() != iOldCurrentItem)
{
...
}
...
}

2. 当需要继承Avkon控件的时候,确保不要被pointer events而妨碍。如果你必须重写HandlePointerEventL函数,那么一定也要调用该子类方法。
Example: File:KineticScrolling.zip

This page was last modified on 30 May 2013, at 04:36.
454 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.

×