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
problem with gbutton
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-02 (23:46)
From: Julien Moutinho <julien.moutinho@g...>
Subject: Re: [Caml-list] problem with gbutton
On Fri, Nov 02, 2007 at 05:48:01PM -0500, Angela Zhu wrote:
> Can anyone give me an example how to set a GButton.button to be
> insensitive or not according to a boolean value "isActive"?

The method #misc#set_sensitive, used by a few examples
in the sources of LablGTK, and documented here:
may do the job:

% cat test.ml
let _ =
    let window = GWindow.window ()
      ~show: true in
    let button = GButton.button ()
      ~label: "hello"
      ~packing: window#add in
    let isActive = false in
    button#misc#set_sensitive isActive;
    ignore (window#connect#destroy
      ~callback: GMain.quit);
    GMain.main ()

% ocamlc -o test -I +lablgtk2 lablgtk.cma gtkInit.cmo test.ml
% ./test