Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] self widget call in camltk
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vincent Barichard <Vincent.Barichard@i...>
Subject: [Caml-list] self widget call in camltk
Hi all,

I use labltk to build a gui for a programm where I need that a button b1 can
enable another button b2 and disable itself. For example :

open Tk

let top = openTk ();;
let b1 = Button.create top ~text:"b1" ~state:`Disabled
  ~command:(fun _ -> Button.configure b2 ~state:`Active;
   Button.configure b1 ~state:`Disabled);;
let b2 = Button.create top ~text:"b2"
  ~command:(fun _ -> Button.configure b1 ~state:`Active;
   Button.configure b2 ~state:`Disabled);;

pack [b1;b2];;
mainLoop ();;
closeTk ();;

#quit;;

Obviously, this code doesn't work because b1 and b2 call themself. How can I
make it work ? Is there any solution to simulate cross reference in labltk ?

Thanks for your help.

Vincent

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners