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.

如何找出功能键的正确位置?

From Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 08 Oct 2007 创建
最后由 hamishwillee 在 16 Nov 2011 编辑
设备, 软件 版本:

S60 3rd Edition and FP1

Nokia E70, Nokia E90, Nokia N93, Nokia N95


  • 详细描述

Command Button Array(CBA)一般位于S60手机屏幕的最下方,如果手机支持横屏竖屏切换的话,那CBA的位置就不固定了(根据屏幕而定)。当S60 UI中的控制面板被正确放置后,可缩放程序应该知道CBA键的正确位置。


  • 解决方案

在有些手机中(如Nokia E70, Nokia E90, Nokia N93, Nokia N95),在横屏模式下功能键将在屏幕左边或右边出现。如果程序需要基于方位对UI(功能键位置)做调整,可以通过

AknLayoutUtils::CbaLocation();

来获取CBA位置。


我们将会得到下列放回值:

    enum TAknCbaLocation
 
{
 
EAknCbaLocationBottom, // landscape and portrait
 
EAknCbaLocationRight, // only landscape
 
EAknCbaLocationLeft // only landscape
 
};


当CBA定位在屏幕下部时,OK/Options键总是定义在左边,而相反的Cancel/Back键总是定义在右边。

当CBA键在屏幕两端时,大部分设备的左功能键总是在下部,但也有列外,如Nokia E90,他就是在上部的位置。

没有API可以直接解决功能键的顺序问题,但可以通过如下方法来监测出按键的位置:

TBool IsOptionsButtonOnTop()
 
{
 
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
 
if( !cba )
 
{
 
return EFalse;
 
}
 
 
 
// Assumes that CBA has Options and Exit commands
 
CCoeControl* options = cba->ControlOrNull( EAknSoftkeyOptions );
 
CCoeControl* exit = cba->ControlOrNull( EAknSoftkeyExit );
 
 
 
if( options && exit )
 
{
 
if( options->Position().iY < exit->Position().iY )
 
{
 
return ETrue;
 
}
 
}
 
return EFalse;
 
}
This page was last modified on 16 November 2011, at 02:26.
56 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.

×