1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
(**************************************************************************)
(* Lablgtk - Examples *)
(* *)
(* This code is in the public domain. *)
(* You may freely copy parts of it in your application. *)
(* *)
(**************************************************************************)
let run () =
GMain.init ();
let w = GWindow.dialog ~title:"Go to page" ~modal:true ~position:`CENTER ()
in
ignore (GMisc.label ~text:"Page: " ~packing:w#vbox#add ());
let sb =
GEdit.spin_button ~packing:w#vbox#add ~digits:0 ~numeric:true ~wrap:true ()
in
sb#adjustment#set_bounds ~lower:0. ~upper:50.0 ~step_incr:1. ();
sb#set_value 22.;
sb#connect#wrapped (fun () -> prerr_endline "Wrapped!");
w#add_button_stock `OK `OK;
w#add_button_stock `CANCEL `CANCEL;
w#set_default_response `OK;
let on_ok () = Format.printf "Ok...@." ; w#destroy () in
match w#run () with
| `DELETE_EVENT | `CANCEL -> w#destroy ()
| `OK -> on_ok ()
let () = run ()
|