MTK platform list controlThe usage is described in this article, mainly to understand and learn howMTK PlatformUseList controls, Search for information online, read the book "MMI instance training tutorial", modify the Code as follows:
Code
- Fixed_list_menu My_fixed_list_menu; // list menu framework
- Fixed_icontext_menuitem My_fixed_icontext_menuitem_common; // public attribute of the menu item
- # Define My_fixed_list_n_items (8) // Number of menu items
- Fixed_icontext_menuitem_type My_fixed_list_menuitems [My_fixed_list_n_items]; // icontext menu item list
- Void * My_fixed_menuitem_pointers [My_fixed_list_n_items]; // The index list pointing to the menu item list
- Void Test_List_Ctrl (void ){
- S32 I;
- EntryNewScreen (SCR_ID_GOOME_GPS_FOOTPRINT_SET_TARGET, NULL, NULL); // start to display the menu
- Memset (& My_fixed_list_menu, 0, sizeof (fixed_list_menu ));
- Gui_create_fixed_list_menu (& My_fixed_list_menu, 20, MMI_content_y + 5,136, MMI_content_height-50 );
- MMI_current_menu_type = LIST_MENU;
- Memset (& My_fixed_icontext_menuitem_common, 0, sizeof (fixed_icontext_menuitem ));
- Gui_create_fixed_icontext_menuitem (& My_fixed_icontext_menuitem_common, 136, 18); // width and height
- Gui_fixed_icontext_menuitem_set_text_position (& My_fixed_icontext_menuitem_common, 24, 0); // text offset distance
- My_fixed_icontext_menuitem_common.flags | = UI_MENUITEM_DISABLE_BACKGROUND; // unified identifier
- Memset (& My_fixed_list_menuitems, 0, sizeof (fixed_icontext_menuitem_type) * My_fixed_list_n_items );
- For (I = 0; I <My_fixed_list_n_items; I ++ ){
- My_fixed_list_menuitems [I]. item_text = (UI_string_type) GetString (STR_ID_GOOME_GPS_FOOTPRINT); // The menu item text
- My_fixed_list_menuitems [I]. item_icon = (PU8) GetImage (IMG_GLOBAL_L1 + I); // menu item icon
- My_fixed_list_menuitems [I]. flags = (UI_MENUITEM_CENTER_TEXT_Y | UI_MENUITEM_CENTER_ICON_Y );
- My_fixed_list_menuitems [I]. item_icon_handle = GDI_ERROR_HANDLE;
- My_fixed_menuitem_pointers [I] = (void *) & My_fixed_list_menuitems [I]; // assign a value to the index list
- }
- My_fixed_list_menu.items = My_fixed_menuitem_pointers; // menu item index list
- My_fixed_list_menu.common_item_data = (void *) & My_fixed_icontext_menuitem_common; // public attributes of menu items
- My_fixed_list_menu.n_items = My_fixed_list_n_items; // Number of menu items
- Gui_set_fixed_list_menu_item_functions (& My_fixed_list_menu, // menu item function interface
- Gui_show_fixed_icontext_menuitem, // display the menu item Function
- Gui_measure_fixed_icontext_menuitem, // measure menu item Function
- Gui_highlight_fixed_icontext_menuitem, // The highlighted Function
- Gui_remove_highlight_fixed_icontext_menuitem, // The highlighted function is lost.
- Gui_hide_fixed_icontext_menuitem, // hides a function from a menu item.
- NULL
- );
- My_fixed_list_menu.highlighted_item =-1; // the index of the highlighted menu item. This is the internal attribute value of the menu framework. You must set it to-1 before redirecting.
- Gui_fixed_list_menu_goto_item (& My_fixed_list_menu, 0 );
- Gui_show_fixed_list_menu (& My_fixed_list_menu); // display the menu end
- Ui_BLT_double_buffer (0, 0, UI_device_width-1, UI_device_height-1 );
- SetKeyHandler (GoBackHistory, KEY_RSK, KEY_EVENT_UP );
- }
After the program is added, it starts to compile. Of course, some other errors will occur, which will be called slowly. Then there will be an error:
- gui_set_fixed_list_menu_item_functions
Wrong number parament, again compared with the example in the book, there is no error, search for this function in the project, found that it is eight parameters, not to mention, add resize_fixed_icontext_menuitems to add the newly added function name in gui_set_fixed_list_menu_item_functions, and change NULL to gui_get_fixed_icontext_menuitem_flag.
Re-compile the file, saying that the resize_fixed_icontext_menuitems function is not found. Add the header file again.
# Include "wgui_fixed_menuitems.h"
Compilation, no error. debugging is successful on the real machine.
Summary: AboutMTK platform list controlThe content of the usage method has been introduced. I hope this article will help you!