[Haskell-cafe] more gtk help
briand at aracnet.com
briand at aracnet.com
Mon Aug 12 04:52:35 CEST 2013
after getting the entry widget events to work as i wanted, i started looking at some other things to do, and my first attempt failed with this :
Couldn't match expected type `Gtk.Signal
(Gtk.Signal self0 (Gtk.EventM Gtk.EExpose Bool)) (t0 -> IO ())'
with actual type `GtkGL.GLDrawingArea'
In the second argument of `Gtk.on', namely `glCanvas'
In the expression: Gtk.on Gtk.exposeEvent glCanvas
In a stmt of a 'do' block:
Gtk.on Gtk.exposeEvent glCanvas $ \ _ -> putStrLn "foo"
Gtk.on Gtk.exposeEvent glCanvas $ putStrLn "foo"
glCanvas is
glCanvas <- GtkGL.glDrawingAreaNew glconfig
I looked up the type of Gtk.on and exposeEvent :
exposeEvent
:: WidgetClass self => Signal self (EventM EExpose Bool)
on
:: object
-> Signal object callback -> callback -> IO (ConnectId object)
There are numerous problems starting with the type of 'callback' that I can't seem to trace in the documentation. And I can't figure out why callback is repeated...
unfortunately it's not obvious what's going on. The type of the entry widget callback is much simpler, and quite a bit different, so I it's of little help.
I'm having a hard time finding appropriate examples because everything seems to use the deprecated convention of on{eventType}, e.g. onExposeEvent or onButtonPress.
I was hoping someone could teach me to fish and parse out the type for me and provide a simple example.
Just pointing me to up-to-date examples would almost certainly be good enough, but I really need to understand the convention here, since I suspect as I try to attach events to other widget types I will see these sorts of problems again.
Thanks,
Brian
More information about the Haskell-Cafe
mailing list