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 29 30 31 32 33 34 35 36 37
|
(**************************************************************************)
(* Lablgtk - Examples *)
(* *)
(* This code is in the public domain. *)
(* You may freely copy parts of it in your application. *)
(* *)
(**************************************************************************)
(* $Id$ *)
let main () =
GMain.init ();
let window = GWindow.window ~title:"Notebook" ~border_width:10 () in
window#connect#destroy ~callback:GMain.quit;
let notebook = GPack.notebook ~packing:window#add () in
let button = GButton.button ~label:"Page 1"
~packing:(fun w -> ignore (notebook#append_page w)) () in
button#connect#clicked ~callback:
(fun () -> prerr_endline "Hello again - cool button 1 was pressed");
let button = GButton.button ~label:"Page 2"
~packing:(fun w -> ignore (notebook#append_page w))
() in
button#connect#clicked ~callback:
(fun () -> prerr_endline "Hello again - cool button 2 was pressed");
notebook#connect#switch_page
~callback:(fun i -> prerr_endline ("Page switch to " ^ string_of_int i));
button#connect#clicked ~callback:
(fun () -> prerr_endline "Coucou");
window#show ();
GMain.main ()
let _ = main ()
(* Local Variables: *)
(* compile-command: "ocamlc -I ../src -w s lablgtk.cma notebook.ml" *)
(* End: *)
|