From f3ffe32385c7b513022304ef33e21f53d217e92a Mon Sep 17 00:00:00 2001 From: Pierre Weis Date: Wed, 27 Feb 2013 19:20:54 +0000 Subject: Some rewriting. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13323 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/labltk/examples_camltk/helloworld.ml | 47 ++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'otherlibs/labltk/examples_camltk/helloworld.ml') diff --git a/otherlibs/labltk/examples_camltk/helloworld.ml b/otherlibs/labltk/examples_camltk/helloworld.ml index 9829fca84..c90d7bd6e 100644 --- a/otherlibs/labltk/examples_camltk/helloworld.ml +++ b/otherlibs/labltk/examples_camltk/helloworld.ml @@ -13,25 +13,38 @@ (* described in file LICENSE found in the OCaml source tree. *) (* *) (***********************************************************************) -open Camltk;; (* Make interface functions available *) -let top = opentk ();; (* Initialisation of the interface *) -(* top is now the toplevel widget *) +(* Make interface functions available *) +open Camltk;; + +(* Initialisation of the interface. *) +let top = opentk ();; +(* top is now the toplevel widget. *) (* Widget initialisation *) -let b = Button.create top - [Text "foobar"; - Command (function () -> - print_string "foobar"; - print_newline(); - flush stdout)];; -(* b exists but is not yet visible *) +let b = + Button.create top [ + Text "foobar"; + Command + (function () -> + print_string "foobar"; + print_newline (); + flush stdout); + ] +;; +(* Now button [b] exists but is not yet visible. *) + +let q = + Button.create top [ + Text "quit"; + Command closeTk; + ] +;; +(* Button [q] also exists but is not yet visible. *) -let q = Button.create top - [Text "quit"; - Command closeTk];; -(* q exists but is not yet visible *) +(* Make b and q visible. *) +pack [b; q] [];; -pack [b; q][] ;; (* Make b visible *) -mainLoop() ;; (* User interaction*) -(* You can quit this program by deleting its main window *) +(* Start user interaction. *) +mainLoop ();; +(* You can also quit this program by deleting its main window. *) -- cgit v1.2.3-70-g09d2