GTK + Reactive

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GTK + Reactive

Levi Stephen-2
Hi,

I'm trying to set up a simple program combining Reactive and GTK. I have the
program below so far, but mainQuit is never called. After looking at a
couple of adapters I tried adding the commented out line, but this didn't
work for me.

I'm sure I've probably missed something, but I'm not sure what.

Thanks,
Levi

main = do
 initGUI

 clock <- makeClock

 (windowDestroy, sink) <- makeEvent clock

 w <- windowNew
 w `onDestroy` sink ()
 widgetShowAll w

 -- forkE (tSync clock) $ quitOnDestroy windowDestroy

 mainGUI

quitOnDestroy :: Event () -> Event (IO ())
quitOnDestroy e = fmap (const mainQuit) e

tSync :: Clock TimeT-> ITime -> IO ()
tSync clock t = sleepPast (cGetTime clock) (exact t)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081124/90a1b4ee/attachment.htm
Reply | Threaded
Open this post in threaded view
|

GTK + Reactive

Bas van Dijk-2
CCing this to the Reactive mailinglist.
See: http://www.haskell.org/mailman/listinfo/reactive

Bas

On Mon, Nov 24, 2008 at 1:00 PM, Levi Stephen <[hidden email]> wrote:

> Hi,
>
> I'm trying to set up a simple program combining Reactive and GTK. I have the
> program below so far, but mainQuit is never called. After looking at a
> couple of adapters I tried adding the commented out line, but this didn't
> work for me.
>
> I'm sure I've probably missed something, but I'm not sure what.
>
> Thanks,
> Levi
>
> main = do
>  initGUI
>
>  clock <- makeClock
>
>  (windowDestroy, sink) <- makeEvent clock
>
>  w <- windowNew
>  w `onDestroy` sink ()
>  widgetShowAll w
>
>  -- forkE (tSync clock) $ quitOnDestroy windowDestroy
>
>  mainGUI
>
> quitOnDestroy :: Event () -> Event (IO ())
> quitOnDestroy e = fmap (const mainQuit) e
>
> tSync :: Clock TimeT-> ITime -> IO ()
> tSync clock t = sleepPast (cGetTime clock) (exact t)
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/beginners
>
>