Use the list control on the MTK platform, search for information online, read the book MMI instance training tutorial written by Fu Gui, and 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
Gui_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.