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.

60系列应用的全屏处理

From Wiki
Jump to: navigation, search
Article Metadata

文章
r60600 在 08 Nov 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

60系列应用的全屏处理的方法一般有两种。

一.对于传统结构的应用,可以在继承自CAknAppUi的AppUi中通过隐藏按钮区:Cba()->MakeVisible(EFalse)和隐藏状态栏:StatusPane()->MakeVisible(EFalse)来实现。

需要指出的是,以上操作最好在加载视图之前进行,例如:

 void CxxxAppUi::ConstructL()
    {
    BaseConstructL();
    
    Cba()->MakeVisible(EFalse); 

    StatusPane()->MakeVisible(EFalse); 

    iAppView = CxxxAppView::NewL( ClientRect() );
    }

也就是要先隐藏按钮区和状态栏,让视图控制获得按钮区(controlpane)和状态栏(statuspane)加上主屏幕(mainpane)的区域显示整个视图对象,否则就会出现视图控制区域非全屏的情况。

此外,AppUi中还必须定义一个HandleKeyEventL方法处理按键,如下:

 TKeyResponse  CxxxAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if (aType==EEventKeyDown && (aKeyEvent.iScanCode == EStdKeyDevice0 || aKeyEvent.iScanCode == EStdKeyDevice1))    
{
Cba()->MakeVisible(ETrue);
}
else
{
Cba()->MakeVisible(EFalse);   
}
return EKeyWasNotConsumed;
}

这样可以在按左右功能键时显示按钮区,不用时再隐藏。


而多视图结构的应用(AppUi继承自CAknViewAppUi),最简单的方法是在某个视图(view)的容器(container)中:

 void CxxxContainer::ConstructL( const TRect& aRect )
{
...

SetExtentToWholeScreen();

ActivateL();
}

同样的左右功能键按下时可以按钮区,且不用定义HandleKeyEventL。要注意的是:SetExtentToWholeScreen()必须放在ActivateL()前。

另外,在多视图结构应用的AppUi中,StatusPane()->MakeVisible(EFalse)也同样有效,只是最好放在SetDefaultViewL()后 。

This page was last modified on 15 December 2011, at 10:23.
262 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.

×