4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-16 06:09:19 +08:00
rt-thread-official/examples/gui/demo_view_combobox.c
dzzxzz@gmail.com 9a99573152 sync gui examples with github 6cf0a8bc19c292ca810c917574895c8defa3922e
As always, full log is in GitHub.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2254 bbd45198-f89e-11dd-88c7-29a3b14d5316
2012-08-13 08:32:01 +00:00

41 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 程序清单label控件演示
*
* 这个例子会在创建出的container上添加几个不同类型的label控件
*/
#include "demo_view.h"
#include <rtgui/widgets/combobox.h>
struct rtgui_listbox_item items[] =
{
{"item 1", RT_NULL},
{"item 2", RT_NULL},
{"item 3", RT_NULL},
{"item 4", RT_NULL},
{"item 5", RT_NULL},
};
/* 创建用于演示combobox控件的视图 */
rtgui_container_t *demo_view_combobox(void)
{
rtgui_rect_t rect;
rtgui_container_t *container;
rtgui_combobox_t *box;
/* 先创建一个演示用的视图 */
container = demo_view("ComboBox View");
/* 获得视图的位置信息 */
demo_view_get_rect(container, &rect);
rect.x1 += 5;
rect.x2 -= 5;
rect.y1 += 5;
rect.y2 = rect.y1 + 20;
/* 创建一个label控件 */
box = rtgui_combobox_create(items, sizeof(items) / sizeof(items[0]), &rect);
/* container是一个container控件调用add_child方法添加这个box控件 */
rtgui_container_add_child(container, RTGUI_WIDGET(box));
return container;
}