1
0

gui.c 709 B

1234567891011121314151617181920212223242526
  1. #include <rtgui/rtgui.h>
  2. #include <rtgui/widgets/window.h>
  3. #include <rtgui/widgets/label.h>
  4. #include <finsh.h>
  5. void msg()
  6. {
  7. struct rtgui_win* msgbox;
  8. struct rtgui_rect rect = {50, 50, 200, 200};
  9. msgbox = rtgui_win_create("Information", &rect, RTGUI_WIN_STYLE_DEFAULT);
  10. if (msgbox != RT_NULL)
  11. {
  12. struct rtgui_box* box = rtgui_box_create(RTGUI_VERTICAL, RT_NULL);
  13. struct rtgui_label* label = rtgui_label_create("Hello World");
  14. rtgui_win_set_box(msgbox, box);
  15. RTGUI_WIDGET(label)->align = RTGUI_ALIGN_CENTER_HORIZONTAL |
  16. RTGUI_ALIGN_CENTER_VERTICAL;
  17. rtgui_box_append(box, RTGUI_WIDGET(label));
  18. rtgui_win_show(msgbox);
  19. }
  20. }
  21. FINSH_FUNCTION_EXPORT(msg, msg on gui)