caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Labltk: Canvas item -state hidden
@ 2005-04-20  8:22 Dirk Thierbach
  2005-04-20 16:38 ` [Caml-list] " Matt Gushee
  0 siblings, 1 reply; 2+ messages in thread
From: Dirk Thierbach @ 2005-04-20  8:22 UTC (permalink / raw)
  To: caml-list

Is there any reason that Labltk doesn't allow to configure canvas items
with -state hidden (or with any state at all)?

After wading through the interface information, I came up with 
the following workaround:

let canvas_configure_item ?state widget tag = 
  let tk_widget = cCAMLtoTKwidget widget in
  let tk_state = match state with 
    | None           -> []
    | Some `Normal   -> [TkToken "-state"; TkToken "normal"]
    | Some `Disabled -> [TkToken "-state"; TkToken "disabled"]
    | Some `Hidden   -> [TkToken "-state"; TkToken "hidden"]
  in
  (* Tk.Tkintf.cCAMLtOTKtagOrId doesn't quote the tag *)
  let cCAMLtoTKtag (tag : Tk.tagOrId) = match tag with
    | `Id i  -> TkToken (string_of_int i)
    | `Tag s -> TkQuote (TkToken s)
  in
  let tk_tag = cCAMLtoTKtag tag in
  let cmd = TkTokenList [tk_widget; TkToken "itemconfigure"; tk_tag] in
  tkCommand [| cmd; TkTokenList tk_state |] 

But of course it would be nicer if Labltk would already support it :-)

- Dirk


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-20 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20  8:22 Labltk: Canvas item -state hidden Dirk Thierbach
2005-04-20 16:38 ` [Caml-list] " Matt Gushee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).