~ubuntu-branches/ubuntu/hardy/ocaml-doc/hardy

« back to all changes in this revision

Viewing changes to examples/camltktutorial/complexegui.ml

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-08 01:49:22 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908014922-lvihyehz0ndq7suu
Tags: 3.10-1
* New upstream release.
* Removed camlp4 documentation since it is not up-to-date.
* Updated to standards version 3.7.2, no changes needed.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
open Tk;;
2
 
 
3
 
let parse_logic_message() =
4
 
  let s = input_line stdin in
5
 
  try
6
 
    ignore (int_of_string s); s
7
 
  with
8
 
    Failure _ -> "invalid server response";;
9
 
 
10
 
let bclick_cb b () =
11
 
  output_string stdout "bouton\n"; flush stdout;
12
 
  let s = parse_logic_message () in
13
 
  Button.configure b [Text s];;
14
 
 
15
 
let topwindow = openTk();;
16
 
 
17
 
let bcount = Button.create topwindow [Text "never clicked"];;
18
 
 
19
 
let bclick = Button.create topwindow
20
 
    [Text "hello world!"; Command(bclick_cb bcount)];;
21
 
 
22
 
let bquit = Button.create topwindow [Text "Quit"; Command closeTk];;
23
 
 
24
 
let gui_server () =
25
 
  Button.configure bquit
26
 
    [Background (NamedColor "red"); Foreground (NamedColor "white")];
27
 
  pack [bclick; bcount; bquit] [Side Side_Left];
28
 
  mainLoop();;