6 let window = GWindow.window () in
7 window#misc#set_name "Test input";
8 window#connect#destroy ~callback:Main.quit;
10 let vbox = GPack.vbox ~packing:window#add () in
13 GMisc.drawing_area ~width:200 ~height:200 ~packing:vbox#add () in
15 drawing_area#event#connect#key_press ~callback:
17 let key = GdkEvent.Key.keyval ev in
18 if key >= 32 && key < 256 then
19 Printf.printf "I got a %c\n" (Char.chr key)
21 print_string "I got another key\n";
26 drawing_area#event#add
27 [`EXPOSURE;`LEAVE_NOTIFY;`BUTTON_PRESS;
28 `POINTER_MOTION;`POINTER_MOTION_HINT;`PROXIMITY_OUT];
29 drawing_area#event#set_extensions `ALL;
30 drawing_area#misc#set_can_focus true;
31 drawing_area#misc#grab_focus ();
33 GButton.button ~label:"Input Dialog" ~packing:vbox#pack ();
36 GButton.button ~label:"Quit" ~packing:vbox#pack () in
38 button#connect#clicked ~callback:window#destroy;