×
Namespaces

Variants
Actions

如何在S60中动态改变功能键并置之为无效

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

文章
huwell 在 05 Jul 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 1st Edition

S60 2nd Edition

S60 3rd Edition


  • 详细描述:

可以通过如下方法来动态改变功能键:

在.rss文件中定义一个新的CBA资源

RESOURCE CBA r_custom_cba1
{
 
buttons =
 
{
 
CBA_BUTTON { id = ECba1Button1; txt = "Button1"; },
 
CBA_BUTTON { id = ECba1Button2; txt = "Button2"; }
 
};
 
}


在.hrh文件中定义一个新的command ID

    enum TMyMenuCmdIDs
{
 
// ...
 
ECba1Button1,
 
ECba1Button2
 
};


在代码中调用SetCommandSetL():

#include <eikbtgpc.h> 
 
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
 
cba->SetCommandSetL(R_CUSTOM_CBA1);
 
cba->DrawNow();


如果要将CBA改变为Options/Cancel,可以参考avkon.rsg中的预先定义:

cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_CANCEL);

如果要置之无效的话,可以使用预先定义的资源名R_AVKON_SOFTKEYS_EMPTY

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

×