Changeset 8009dc27 in mainline for uspace/app/uidemo/uidemo.c
- Timestamp:
- 2020-10-31T01:03:26Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4df6607
- Parents:
- f03d1308
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
rf03d1308 r8009dc27 40 40 #include <str.h> 41 41 #include <task.h> 42 #include <ui/fixed.h> 42 43 #include <ui/label.h> 43 44 #include <ui/pbutton.h> … … 84 85 85 86 /* Make sure we don't process events until fully initialized */ 86 if (demo-> pb1 == NULL || demo->pb2== NULL)87 if (demo->fixed == NULL) 87 88 return; 88 89 89 ui_pbutton_pos_event(demo->pb1, event); 90 ui_pbutton_pos_event(demo->pb2, event); 90 ui_fixed_pos_event(demo->fixed, event); 91 91 } 92 92 … … 159 159 ui_window_get_app_rect(window, &app_rect); 160 160 161 rc = ui_fixed_create(&demo.fixed); 162 if (rc != EOK) { 163 printf("Error creating fixed layout.\n"); 164 return rc; 165 } 166 161 167 rc = ui_label_create(ui_res, "Hello there!", &demo.label); 162 168 if (rc != EOK) { … … 172 178 ui_label_set_halign(demo.label, gfx_halign_center); 173 179 180 rc = ui_fixed_add(demo.fixed, ui_label_ctl(demo.label)); 181 if (rc != EOK) { 182 printf("Error adding control to layout.\n"); 183 return rc; 184 } 185 174 186 rc = ui_pbutton_create(ui_res, "Confirm", &demo.pb1); 175 187 if (rc != EOK) { … … 188 200 ui_pbutton_set_default(demo.pb1, true); 189 201 202 rc = ui_fixed_add(demo.fixed, ui_pbutton_ctl(demo.pb1)); 203 if (rc != EOK) { 204 printf("Error adding control to layout.\n"); 205 return rc; 206 } 207 190 208 rc = ui_pbutton_create(ui_res, "Cancel", &demo.pb2); 191 209 if (rc != EOK) { … … 202 220 ui_pbutton_set_rect(demo.pb2, &rect); 203 221 222 rc = ui_fixed_add(demo.fixed, ui_pbutton_ctl(demo.pb2)); 223 if (rc != EOK) { 224 printf("Error adding control to layout.\n"); 225 return rc; 226 } 227 204 228 rc = gfx_color_new_rgb_i16(0xc8c8, 0xc8c8, 0xc8c8, &color); 205 229 if (rc != EOK) { … … 239 263 240 264 ui_run(ui); 265 266 ui_fixed_remove(demo.fixed, ui_label_ctl(demo.label)); 267 ui_fixed_remove(demo.fixed, ui_pbutton_ctl(demo.pb1)); 268 ui_fixed_remove(demo.fixed, ui_pbutton_ctl(demo.pb2)); 241 269 242 270 ui_pbutton_destroy(demo.pb1);
Note:
See TracChangeset
for help on using the changeset viewer.