I also want to add
 
      GMain.Idle.add ~callback:(fun () ->  true);

But I keep getting:

***********
Expecting function has type ?prio:int -> (unit -> bool) -> Glib.Idle.id
This argument cannot be applied with label ~callback

Any idea?

Thanks,
Angela



On 11/2/07, Julien Moutinho < julien.moutinho@gmail.com> wrote:
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:
  http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk-2.4.0/doc/html/GObj.misc_ops.html#METHODset_sensitive
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

HTH,
  Julien.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



--
Regards,
Angela Zhu
------------------------------------------
Dept. of CS, Rice University
http://www.cs.rice.edu/~yz2/
------------------------------------------