1
0

demo_gui_combobox.c 724 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * 程序清单:label控件演示
  3. *
  4. * 这个例子会在创建出的view上添加几个不同类型的label控件
  5. */
  6. #include "demo_view.h"
  7. #include <rtgui/widgets/combobox.h>
  8. rtgui_listbox_item_t items[] =
  9. {
  10. {"item 1", RT_NULL},
  11. {"item 2", RT_NULL},
  12. {"item 3", RT_NULL},
  13. };
  14. /* 创建用于演示combobox控件的视图 */
  15. rtgui_view_t* demo_gui_combobox(rtgui_view_t* parent_view)
  16. {
  17. rtgui_view_t* view;
  18. rtgui_combo_t* box;
  19. /* 先创建一个演示用的视图 */
  20. view = demo_view_create(parent_view, "ComboBox View");
  21. box = rtgui_combo_create(view, "demo combo", 5, 40, 120, 20);
  22. rtgui_combo_set_items(box, items, RT_COUNT(items));
  23. box->add_string(box, "add item 1");
  24. box->add_string(box, "add item 2");
  25. return view;
  26. }