How to Use the MTK platform list control

Source: Internet
Author: User

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

 
 
  1. Fixed_list_menu My_fixed_list_menu; // list menu framework
  2. Fixed_icontext_menuitem My_fixed_icontext_menuitem_common; // public attribute of the menu item
  3. # Define My_fixed_list_n_items (8) // Number of menu items
  4. Fixed_icontext_menuitem_type My_fixed_list_menuitems [My_fixed_list_n_items]; // icontext menu item list
  5. Void * My_fixed_menuitem_pointers [My_fixed_list_n_items]; // The index list pointing to the menu item list
  6. Void Test_List_Ctrl (void ){
  7. S32 I;
  8. EntryNewScreen (SCR_ID_GOOME_GPS_FOOTPRINT_SET_TARGET, NULL, NULL); // start to display the menu
  9. Memset (& My_fixed_list_menu, 0, sizeof (fixed_list_menu ));
  10. Gui_create_fixed_list_menu (& My_fixed_list_menu, 20, MMI_content_y + 5,136, MMI_content_height-50 );
  11. MMI_current_menu_type = LIST_MENU;
  12. Memset (& My_fixed_icontext_menuitem_common, 0, sizeof (fixed_icontext_menuitem ));
  13. Gui_create_fixed_icontext_menuitem (& My_fixed_icontext_menuitem_common, 136, 18); // width and height
  14. Gui_fixed_icontext_menuitem_set_text_position (& My_fixed_icontext_menuitem_common, 24, 0); // text offset distance
  15. My_fixed_icontext_menuitem_common.flags | = UI_MENUITEM_DISABLE_BACKGROUND; // unified identifier
  16. Memset (& My_fixed_list_menuitems, 0, sizeof (fixed_icontext_menuitem_type) * My_fixed_list_n_items );
  17. For (I = 0; I <My_fixed_list_n_items; I ++ ){
  18. My_fixed_list_menuitems [I]. item_text = (UI_string_type) GetString (STR_ID_GOOME_GPS_FOOTPRINT); // The menu item text
  19. My_fixed_list_menuitems [I]. item_icon = (PU8) GetImage (IMG_GLOBAL_L1 + I); // menu item icon
  20. My_fixed_list_menuitems [I]. flags = (UI_MENUITEM_CENTER_TEXT_Y | UI_MENUITEM_CENTER_ICON_Y );
  21. My_fixed_list_menuitems [I]. item_icon_handle = GDI_ERROR_HANDLE;
  22. My_fixed_menuitem_pointers [I] = (void *) & My_fixed_list_menuitems [I]; // assign a value to the index list
  23. }
  24. My_fixed_list_menu.items = My_fixed_menuitem_pointers; // menu item index list
  25. My_fixed_list_menu.common_item_data = (void *) & My_fixed_icontext_menuitem_common; // public attributes of menu items
  26. My_fixed_list_menu.n_items = My_fixed_list_n_items; // Number of menu items
  27. Gui_set_fixed_list_menu_item_functions (& My_fixed_list_menu, // menu item function interface
  28. Gui_show_fixed_icontext_menuitem, // display the menu item Function
  29. Gui_measure_fixed_icontext_menuitem, // measure menu item Function
  30. Gui_highlight_fixed_icontext_menuitem, // The highlighted Function
  31. Gui_remove_highlight_fixed_icontext_menuitem, // The highlighted function is lost.
  32. Gui_hide_fixed_icontext_menuitem, // hides a function from a menu item.
  33. NULL
  34. );
  35. 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.
  36. Gui_fixed_list_menu_goto_item (& My_fixed_list_menu, 0 );
  37. Gui_show_fixed_list_menu (& My_fixed_list_menu); // display the menu end
  38. Ui_BLT_double_buffer (0, 0, UI_device_width-1, UI_device_height-1 );
  39. SetKeyHandler (GoBackHistory, KEY_RSK, KEY_EVENT_UP );
  40. }

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:

 
 
  1. 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.