Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Julien Moutinho <julien.moutinho@g...>
Subject: Re: [Caml-list] problem with gbutton
On Fri, Nov 02, 2007 at 10:20:24PM -0500, Angela Zhu wrote:
> 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?
As said by the error message, the signature of GMain.Idle.add is:
  ?prio:int ->      (* an optional argument: the priority  *)
  (unit -> bool) -> (* an anonymous argument: the callback *)
  Glib.Idle.id      (* the returned value: an identifier   *)
Here no argument of GMain.Idle.add has a label named "callback",
hence the error you get.

Instead do the following:
  let id = GMain.Idle.add (fun _ -> true) in

Also, there is a manual chapter on labels:
  http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html

And by the way, do not forget that there is a mailing list
dedicated to LablGTK:
  http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk

HTH.