]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtk/lablgtk_20000829-0.1.0/examples/events.ml
updated the binding so that it works well with lablgtk-1.00,
[helm.git] / helm / DEVEL / lablgtk / lablgtk_20000829-0.1.0 / examples / events.ml
1 (* $Id$ *)
2
3 open GMain
4
5 let _ =
6   let window = GWindow.window () in
7   window#connect#destroy ~callback:Main.quit;
8
9   let text = GEdit.text ~editable:true ~packing:window#add () in
10   text#event#connect#button_press ~callback:
11     begin fun ev ->
12       GdkEvent.Button.button ev = 3 &&
13       GdkEvent.get_type ev = `BUTTON_PRESS &&
14       begin
15         let pos = text#position in
16         GdkEvent.Button.set_button ev 1;
17         text#event#send (GdkEvent.coerce ev);
18         Printf.printf "Position is %d.\n" text#position;
19         flush stdout;
20         text#set_position pos;
21         true
22       end
23     end;
24   window#show ();
25   Main.main ()