现在的位置: 首页 > 综合 > 正文

brew菜单应用学习体会

2018年05月08日 ⁄ 综合 ⁄ 共 1750字 ⁄ 字号 评论关闭

对于菜单应用来说,应该是brew入门中相对比较复杂的一部分了,对比之前的按键处理、文字显示、定时器等章节的学习,内容和代码修改量都多了很多。

首先是IMenuCtl,下面是相关的SDK说明:

To create and use a menu control
1. Call ISHELL_CreateInstance() to create the menu control instance and obtain an interface pointer to it, specifying which of the four types of menu control you choose by its ClassID. //创建实例

2. Call IMENUCTL_SetRect() to define the screen rectangle in which the menu is to be drawn. //设置区域

3. Call IMENUCTL_SetProperties() to set any of the menu control properties, and call IMENUCTL_SetStyle to customize the appearance of your menu items. //设置菜单属性

4. Call IMENUCTL_SetTitle() to specify a menu title, and call IMENUCTL_AddItem() or IMENUCTL_AddItemEx() for each item to be added to the menu. //设置标题,设置每一项             以上为静态工作,未涉及处理事件。

5. When you have completely specified the properties and contents of the menu control, call IMENUCTL_SetActive() to draw the control on the screen and enable it to receive key events from the device user. While the menu control is active, your application's IAPPLET_HandleEvent() function must call IMENUCTL_HandleEvent() to pass all handled key events to the menu control for processing. // 设置菜单为活动,控制屏幕资源,接受键盘消息 APP的事件处理函数必须调用IME_HE来把所有处理过的按键事件传递到菜单控制来进行处理。

6. Determine how you are to obtain the device user's menu selection. If you process the selection when the device user presses the SELECT key, the IAPPLET_HandleEvent() function can contain logic to handle the selection of each menu item when the EVT_COMMAND is received. If your application receives EVT_COMMAND events from more than one control, be sure that the item IDs passed in the wParam parameter are unique. If you retrieve the device user's selection at some other time, you must call IMENUCTL_GetSel() or IMENUCTL_GetItemData() at this time to access the currently selected menu item and its double-word data, if any. //  逻辑处理- 决定你如何获得设备用户的菜单选择。如果你在用户按下SELECT键时处理选择...

7. When you no longer need the menu control, call IMENUCTL_Release() to free it.   // 当你不再需要菜单控制时,释放

Required header file:AEEMenu.h

 

抱歉!评论已关闭.