English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-07-21 (07:37)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: LablTk
From: Fabien Fleutot <fabien.fleutot@inria.fr>

> I have two problems with LablTk :
> - I want to prevent a window from being destroyed by the WM : it's a
> pretty long to build window, and I'd like to hide it instead of actually
> destroy it when the user clicks on the delete button of the window
> manager. It's easy to do in some langages such as Java, but I can't find
> the way to do it with Labltk.

I do not see anything to do that in Tcl/Tk. You can iconify a window,
using Wm.iconify, but not hide it.
If you really need this kind of power, you may consider switching to

> - I want to use a button to destroy a window. But I can't do
> Button.create win ~text:"Close" ~command:(fun _ -> destroy win)
> since when the destroy function starts, the button, which belongs to
> win, is in use and prevents to destroy its parent win. There is a
> specific function (i.e. Tk_EventuallyFree) in Tcl/Tk to handle such
> cases, but I don't know how to do with LablTk. What I'm currently doing
> is to put the destroying function in a Timer callback, to destroy the
> window .1s after the button has been released, but it's not very safe...

I don't see why your above code wouldn't work. I'm doing it everywhere in
ocamlbrowser (Jg_button.create_destroyer).

Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>