I'm using Gtk2Hs to build a GUI drawing some picture in a window. I use the function onExpose
to connect the expose event to the redrawing function.
onExpose canvas $ \_ -> do
refreshArea canvas ...
return True
Things are working but in reading the Gtk2Hs documentation, I saw that this function is deprecated and will disappear in next version of Gtk2Hs.
Do you know how to replace the onExpose
function to connect the expose event to my funtion for a long time compatibility?
You should use new event handling API. In particular you should install a handler for exposeEvent
, like the next:
on canvas exposeEvent $ do
-- do rendering here...
return True
The same API is provided both by gtk
and gtk3
packages.