Changeset ba09d06 in mainline for uspace/app/uidemo/uidemo.c
- Timestamp:
- 2020-10-20T11:10:32Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20d2c6c
- Parents:
- 1769693
- git-author:
- Jiri Svoboda <jiri@…> (2020-10-19 21:10:12)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-10-20 11:10:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/uidemo/uidemo.c
r1769693 rba09d06 40 40 #include <str.h> 41 41 #include <task.h> 42 #include <ui/label.h> 42 43 #include <ui/pbutton.h> 43 44 #include <ui/resource.h> … … 138 139 { 139 140 ui_demo_t *demo = (ui_demo_t *) arg; 141 errno_t rc; 140 142 141 143 if (pbutton == demo->pb1) { 142 144 printf("Clicked 'Confirm' button\n"); 145 rc = ui_label_set_text(demo->label, "Confirmed"); 146 if (rc != EOK) 147 printf("Error changing label text.\n"); 148 (void) ui_label_paint(demo->label); 143 149 } else { 144 150 printf("Clicked 'Cancel' button\n"); 151 rc = ui_label_set_text(demo->label, "Cancelled"); 152 if (rc != EOK) 153 printf("Error changing label text.\n"); 154 (void) ui_label_paint(demo->label); 145 155 } 146 156 } … … 221 231 ui_wdecor_set_cb(demo.wdecor, &wdecor_cb, (void *) &demo); 222 232 233 rc = ui_label_create(ui_res, "Hello there!", &demo.label); 234 if (rc != EOK) { 235 printf("Error creating label.\n"); 236 return rc; 237 } 238 239 rect.p0.x = 60; 240 rect.p0.y = 37; 241 rect.p1.x = 160; 242 rect.p1.y = 50; 243 ui_label_set_rect(demo.label, &rect); 244 223 245 rc = ui_pbutton_create(ui_res, "Confirm", &demo.pb1); 224 246 if (rc != EOK) { … … 229 251 ui_pbutton_set_cb(demo.pb1, &pbutton_cb, (void *) &demo); 230 252 231 rect.p0.x = 20;232 rect.p0.y = 50;233 rect.p1.x = 10 0;234 rect.p1.y = 8 0;253 rect.p0.x = 15; 254 rect.p0.y = 60; 255 rect.p1.x = 105; 256 rect.p1.y = 88; 235 257 ui_pbutton_set_rect(demo.pb1, &rect); 236 258 … … 245 267 ui_pbutton_set_cb(demo.pb2, &pbutton_cb, (void *) &demo); 246 268 247 rect.p0.x = 1 20;248 rect.p0.y = 50;249 rect.p1.x = 20 0;250 rect.p1.y = 8 0;269 rect.p0.x = 115; 270 rect.p0.y = 60; 271 rect.p1.x = 205; 272 rect.p1.y = 88; 251 273 ui_pbutton_set_rect(demo.pb2, &rect); 252 274 … … 275 297 if (rc != EOK) { 276 298 printf("Error painting window decoration.\n"); 299 return rc; 300 } 301 302 rc = ui_label_paint(demo.label); 303 if (rc != EOK) { 304 printf("Error painting button.\n"); 277 305 return rc; 278 306 }
Note:
See TracChangeset
for help on using the changeset viewer.