Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Camltk: missing State Hidden constructor
[ 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] Camltk: missing State Hidden constructor
From: Arnaud Rouanet <arnaud.rouanet@inria.fr>

> We wanted to use Canvas.configure_text, which accepts an State state
> option, where state may only be Active | Normal | Disabled. We checked
> the Tcl/Tk documentation and there is an additional "hidden" state
> since version 8.3, which would be perfect for our purpose but this
> doesn't appear in the current Camltk version.  It seems the previous
> developper used a trick for this: in his modified version of Camltk,
> the constructor Hidden has been added and then everything just works
> fine.
[..]
> Therefore, we would like to know if there is another way to
> dynamically hide the text, using the standard Camltk distribution.  It
> is rather strange that the State Hidden constructor is not available
> in Camltk.  Is there a good reason for this ?

The reason is that not everybody is using Tcl/Tk 8.3, so that having
it in by default would be unsafe.
An idea would be to generate from different description files for each
version of Tk, but this would loose binary compatibility (and need
some work).
So currently, everybody is limited to Tcl/Tk 8.0 functionality.

If your need is punctual, you can define wrap the function by hand in caml:

   let hide w =
     Protocol.tkEval [| Widget.name w; TkToken"configure"; TkToken"-hidden" |]

With labltk, you should be more explicit with the widget type intended.

  let hide (w : text widget) =
     Protocol.tkEval [| Widget.name w; TkToken"configure"; TkToken"-hidden" |]

Of course your program becomes incompatible with versions older than 8.3.

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