Re: Gdk.cursor / Gtk.Window type error
Erik de Castro Lopo <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Organization | Erik Conspiracy Secret Labs |
| Message-ID | <[email protected]> |
Jacques GARRIGUE wrote:
> You just forgot the parentheses around (win:Gdk.window)
> Without them, this does not specify the type of win, but the return
> type of the function. Hence the error.
I think the lack of parentheses was actually a debugging artifact.
When I add them I get a function with a signature of:
val create_null_cursor : Gdk.window -> Gdk.cursor
but then I run into trouble when I tried use it. If I replaced this
working code:
let cursor = Gdk.Cursor.create `PLUS in
Gdk.Window.set_cursor win#misc#window cursor ;
with:
let cursor = create_null_cursor win in
Gdk.Window.set_cursor win#misc#window cursor ;
I got the following error:
This expression has type GWindow.window but is here used with type
Gdk.window = [ `drawable | `gdkwindow ] Gobject.obj
Changing the above to this:
let cursor = create_null_cursor win#misc#window in
Gdk.Window.set_cursor win#misc#window cursor ;
solved the problem. The fact that I don't use Ocaml's object system
very often made this one a little difficult for me to debug.
Thanks for your help Jacques.
Cheers,
Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Microsoft treats security vulnerabilities as public relations
problems." -- Bruce Schneier