button、label正常,checkbox不显示,什么原因??
button、label正常,checkbox不显示,什么原因??/* 添加一个label */
label = rtgui_label_create("你好!RT-Thread!");
rect.x1 = 40; rect.y1 = 30;
rect.x2 = 210; rect.y2 = 50;
/* 设置label的位置 */
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
//又加一个label
label = rtgui_label_create("BUTTON!");
rect.x1 = 40; rect.y1 = 95;
rect.x2 = 110; rect.y2 = 110;
/* 设置label的位置 */
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
//设置button
rect.x1=40; rect.y1=65;
rect.x2=140; rect.x2=85;
button = rtgui_button_create("密码");
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(button)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(button));
//CHECKbox
rect.x1=40; rect.y1=120;
rect.x2=140; rect.x2=140;
checkbox = rtgui_checkbox_create("Red0",RT_TRUE);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
rect.x1=40; rect.y1=150;
rect.x2=140; rect.x2=170;
checkbox = rtgui_checkbox_create("Green0",RT_TRUE);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = green;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox)); //CHECKbox
rect.x1=40; rect.y1=120;
rect.x2=140; rect.x2=140;
checkbox = rtgui_checkbox_create("Red0",RT_TRUE);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = red;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
rect.x1=40; rect.y1=150;
rect.x2=140; rect.x2=170;
checkbox = rtgui_checkbox_create("Green0",RT_TRUE);
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(checkbox)) = green;
rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(checkbox));
上面的坐标有错误吧?没有设定y2的数值。这样可能绘制不出来。 回复【1楼】tiancaigao7 天才杨威利
//checkbox
rect.x1=40; rect.y1=120;
rect.x2=140; rect.x2=140;
checkbox = rtgui_checkbox_create("red0",rt_true);
rtgui_widget_foreground(rtgui_widget(checkbox)) = red;
rtgui_widget_set_rect(rtgui_widget(checkbox), &rect);
rtgui_container_add_child(rtgui_container(view), rtgui_widget(checkbox));
rect.x1=40; rect.y1=150;
rect.x2=140; rect.x2=170;
checkbox = rtgui_checkbox_creat......
-----------------------------------------------------------------------
我发的是这错了,感谢,不过没有这么多,只有一处错误,这是最初的,感谢 。还是要细心。
页:
[1]