caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dirk Thierbach <dthierbach@gmx.de>
To: caml-list@yquem.inria.fr
Subject: Labltk: Canvas item -state hidden
Date: Wed, 20 Apr 2005 10:22:02 +0200	[thread overview]
Message-ID: <20050420082202.GA2185@feanor> (raw)

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


             reply	other threads:[~2005-04-20 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-20  8:22 Dirk Thierbach [this message]
2005-04-20 16:38 ` [Caml-list] " Matt Gushee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050420082202.GA2185@feanor \
    --to=dthierbach@gmx.de \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).