diff options
author | Pierre Weis <Pierre.Weis@inria.fr> | 2013-02-27 19:20:54 +0000 |
---|---|---|
committer | Pierre Weis <Pierre.Weis@inria.fr> | 2013-02-27 19:20:54 +0000 |
commit | f3ffe32385c7b513022304ef33e21f53d217e92a (patch) | |
tree | bcce94e462c487ed7706be167cedc98d92065eb5 /otherlibs/labltk/examples_camltk | |
parent | 3755a158de061acdfb7cfc6aed785a0bcf2d194e (diff) |
Some rewriting.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13323 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/examples_camltk')
-rw-r--r-- | otherlibs/labltk/examples_camltk/helloworld.ml | 47 |
1 files changed, 30 insertions, 17 deletions
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. *) |