From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 394CEBC6B for ; Sat, 3 Nov 2007 04:20:27 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAL6FK0dA6aa3mGdsb2JhbACCPzSLdwIBAQcCBiuBDw X-IronPort-AV: E=Sophos;i="4.21,365,1188770400"; d="scan'208";a="18888033" Received: from py-out-1112.google.com ([64.233.166.183]) by mail4-smtp-sop.national.inria.fr with ESMTP; 03 Nov 2007 04:20:26 +0100 Received: by py-out-1112.google.com with SMTP id u52so1877745pyb for ; Fri, 02 Nov 2007 20:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=4RyYziml6l2eKgkISrMhjSCxd8dRD0u3diu1KLqtKlE=; b=ScYQFtm01cFX7Q1e4gXkiGorlInp+ZmdbmTYJRb4ZIBvST4ugmximVnPotHJ8oPQqe23R9gpPf/9Pcx7RA4nD3ICX54ssFuW6KKZh/7tuqx7cieypWP/XnIcp9NndxN0BZJRsaZGq9F/pinY1rX3W5VOUq12DEbAhNPMjAHIBqU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=pxgbj+n/CMauOGk+Wgiym314DuyG0wklVA/X4CVcUcsnq/cg+XVdiymboYhce1cjsEg+x40q0s+NlCWMtzy2hRZqIV8ffvk9g9Y72MxEsp/9CCFpQ1mjaCP9oQQyxInBvb9IUekbg4BYcYv5bIxvSE2hcgUvTBciQcQTFIe7pdM= Received: by 10.35.111.14 with SMTP id o14mr2864525pym.1194060024866; Fri, 02 Nov 2007 20:20:24 -0700 (PDT) Received: by 10.35.89.3 with HTTP; Fri, 2 Nov 2007 20:20:24 -0700 (PDT) Message-ID: Date: Fri, 2 Nov 2007 22:20:24 -0500 From: "Angela Zhu" To: "Julien Moutinho" , caml-list@yquem.inria.fr Subject: Re: [Caml-list] problem with gbutton In-Reply-To: <20071102234738.GA7257@localhost> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21824_27552214.1194060024865" References: <20071102234738.GA7257@localhost> X-Spam: no; 0.00; gbutton:01 gmain:01 bool:01 gbutton:01 lablgtk:01 ocaml:01 lablgtk:01 gobj:01 gwindow:01 gmain:01 ocamlc:01 gtkinit:01 cmo:01 beginner's:01 ocaml:01 ------=_Part_21824_27552214.1194060024865 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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/ ------------------------------------------ ------=_Part_21824_27552214.1194060024865 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/
------------------------------------------ ------=_Part_21824_27552214.1194060024865--