application/main.c

changeset 98
efaae97bd95b
parent 97
1a786201465f
child 99
ea1a2d5de765
--- a/application/main.c	Sun Nov 29 21:43:03 2015 +0100
+++ b/application/main.c	Mon Nov 30 14:09:55 2015 +0100
@@ -64,6 +64,11 @@
     ui_text_free(text);
 }
 
+void click(UiEvent *event, void *data) {
+    UiMouseEvent *me = event->eventdata;
+    printf("click[%d](%d,%d)\n", me->type, me->x, me->y);
+}
+
 int main(int argc, char** argv) { 
     ui_init("app1", argc, argv);
     
@@ -83,7 +88,8 @@
     ui_toolbar_add_default("button2");
     
     UiObject *obj = ui_window("Test", NULL);
-    ui_drawingarea(obj, draw, NULL);
+    UIWIDGET w = ui_drawingarea(obj, draw, NULL);
+    ui_mouse_handler(obj, w, click, NULL);
     
     ui_show(obj);
     ui_main();

mercurial