[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dirk Thierbach <dthierbach@g...> |
| Subject: | Labltk: Canvas item -state hidden |
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