×
Namespaces

Variants
Actions
Revision as of 08:29, 15 December 2011 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Single tap on symbian^3

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

文章
shenjianguo 在 07 May 2010 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

In S60 5th 中,可以通过 single tap,long tap,double tap 来处理列表或菜单,到了Symbian^3只要single tap就可以实现以前的功能,更方便也更人性化,下面我们移植一个应用,在Forum Nokia下载CalendarAPIexample,这是个S60 5th程序,在S60 5th SDK下可以编译运行。技术文档可以下载

在Symbian^3 SDK中,需要做如下修改:

.pkg文件中增加Symbian^3 支持

[0x20022E6D], 0, 0, 0, {"Series60ProductID"}

CalendarAPIexample.mmp 文件增加

SYSTEMINCLUDE \epoc32\include\mw SYSTEMINCLUDE \epoc32\include\platform\mw 支持symbian 3 的 .h 文件

CAPABILITY ReadUserData WriteUserData WriteDeviceData 能力增加WriteDeviceData,这个是和以前有区别的,没有这项在真机运行会报错


CalendarAPIexampleAppUi.cpp 文件的 ConstructL() 函数做如下修改:

BaseConstructL(EAknEnableSkin | EAknEnableMSK);

==>

BaseConstructL(EAknEnableSkin | EAknTouchCompatible | EAknSingleClickCompatible);

EAknEnableMSK 纯触屏手机不会有这个键 EAknTouchCompatible 区别Touch和非Touch事件 EAknSingleClickCompatible 让我们的应用可以处理 Single Tap


在CalendarAPIexampleSearchContainer.cpp和CalendarAPIexampleEntriesContainer.cpp两个文件中都有函数HandleListBoxEventL,修改如下:

if (aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked)

==>

if (aEventType == EEventEnterKeyPressed || aEventType == EEventItemSingleClicked)

不再处理 double tap,只处理 single tap事件。

至此,可以编译运行,并在真机看看效果,已经可以处理 single tap事件了。

但是在选项菜单中,还有相对应的菜单项,symbian^3 提供了两个标识EEikMenuItemAction, EEikMenuItemSpecific这些菜单项

修改文件CalendarAPIexample.rss

RESOURCE MENU_PANE r_calendarapiexample_search_menu
{
items =
{
MENU_ITEM { command = ECalendarAPIexampleCmdSearch; txt = qtn_options_search; <span style="color:##ff0000"> flags = EEikMenuItemAction;</span> },
MENU_ITEM { command = ECalendarAPIexampleCmdAdd; txt = qtn_options_add; },
MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; }
};
}
 
RESOURCE MENU_PANE r_calendarapiexample_entries_menu
{
items =
{
MENU_ITEM { command = ECalendarAPIexampleCmdEdit; txt = qtn_options_edit; <span style="color:##ff0000">flags = EEikMenuItemAction;</span> },
MENU_ITEM { command = ECalendarAPIexampleCmdDelete; txt = qtn_options_delete; <span style="color:##ff0000">flags = EEikMenuItemSpecific;</span> }
};
}

增加红色的代码

Image001.jpg Image004.jpg


Image006.jpg Image008.jpg


可以看出前后的变化

Image010.jpg Image012.jpg

这是EEikMenuItemSpecific的操作过程:button down -> hold -> pop up menu。

而EEikMenuItemAction 的操作时:button down -> button release -> action。

在菜单中EEikMenuItemAction项就是该项需要执行的操作,所以只有一个,而EEikMenuItemSpecific是可以选择的,可以有多项,都会出现在popup菜单中

This page was last modified on 15 December 2011, at 08:29.
309 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.

×