我新建了个“GUI Application with UI Designer”项目,模板选用 “Form”,自动生成的文件有:
BluetoothSampleApplication.cpp
BluetoothSampleAppUi.cpp
BluetoothSampleDocument.cpp
BluetoothSampleForm.cpp
BluetoothSampleFormView.cpp
现在我想添加自己的菜单,我是这样操作的:
先在 data 下面的 BluetoothSampleForm.rssi 里面添加:
- C/C++ code
RESOURCE AVKON_VIEW r_bluetooth_sample_form_bluetooth_sample_form_view { menubar = r_bluetooth_sample_menu; cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; }RESOURCE MENU_BAR r_bluetooth_sample_menu{ titles = { MENU_TITLE {menu_pane = r_bluetooth_sample_menuitems; txt = STR_MENU_OPERATE; } };}RESOURCE MENU_PANE r_bluetooth_sample_menuitems{ items = { MENU_ITEM {command = EBluetoothSampleStart; txt = STR_MENUITEM_START; }, MENU_ITEM {command = EBluetoothSampleStop; txt = STR_MENUITEM_STOP; } };}
然后在 BluetoothSample.loc 文件里面添加:
- C/C++ code
#define STR_MENU_OPERATE "操作"#define STR_MENUITEM_START "启动"#define STR_MENUITEM_STOP "停止"
再在 hrh 文件里面添加:
- C/C++ code
enum TBluetoothSampleCommandIds{ // 启动 EBluetoothSampleStart = 1, // 停止 EBluetoothSampleStop = 2 };
这样启动后自定义这个菜单根本显示不出来,只显示系统默认的菜单:
按选项后只显示“显示打开的应用程序”和“编辑”两个
请问还有哪里需要改动吗?
------解决方案--------------------------------------------------------
R_AVKON_SOFTKEYS_OPTIONS_BACK
这个是系统定义的CBA资源
你想实现的是自定义CBA,所以应该把CBA也要自定义一下。
------解决方案--------------------------------------------------------
不是很清楚,也学习一下