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: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] self widget call in camltk
From: "Vincent Barichard" <Vincent.Barichard@info.univ-angers.fr>

> 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 :
> 
> 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);;

That's pretty classical. You can add the command after creating the
button:
let b1 = Button.create top ~text:"b1" ~state:`Disabled
let b2 = Button.create top ~text:"b2"
let () =
  Button.configure b1 ~command:(...);
  Button.configure b2 ~command:(...)

Jacques Garrigue

-------------------
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