* [Caml-list] self widget call in camltk
@ 2003-10-01 11:59 Vincent Barichard
2003-10-01 23:54 ` Jacques Garrigue
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Barichard @ 2003-10-01 11:59 UTC (permalink / raw)
To: CAML LIST
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] self widget call in camltk
2003-10-01 11:59 [Caml-list] self widget call in camltk Vincent Barichard
@ 2003-10-01 23:54 ` Jacques Garrigue
0 siblings, 0 replies; 2+ messages in thread
From: Jacques Garrigue @ 2003-10-01 23:54 UTC (permalink / raw)
To: Vincent.Barichard; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-01 23:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-01 11:59 [Caml-list] self widget call in camltk Vincent Barichard
2003-10-01 23:54 ` Jacques Garrigue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox