Hi Fabian,
It might be that the frame is not receiving any key events ???
In my experience it might work better to put in some kind
of control, like a "panel". I guess this has to do how more
with the native platform (windows, gtk, etc) than with wxHaskell
as such.
I hope this helps,
-- Daan.
> hey!
> I'm currently writing my first program with wxhaskell, in fact, it's th=
e
> first time I'm using haskell to write a program that goes beyond basic
> data-structures and sorting algorithms so I hope this question doesn't
> turn out to be non-wxhaskell specific.
>
> Basically, what I want to do is react on key-presses just like in the
> bouncing balls example or in this tutorial:
> http://www.cs.uu.nl/~daan/download/papers/wxhaskell.pdf.
>
> So I wrote the following:
>
> mainFrame =3D do
> cs <- variable [ value :=3D (CSys (Rt start_ul start_lr))]
> f <- frame []
>
> set f[
> layout :=3D space fwidth fheight
> , on paint :=3D drawCoordSys cs fwidth fheight
> , text:=3D "Coordinate System"
> , on leftKey :=3D do set cs [value :~ \x -> (csys_shift_x x
> (-(fac_x_p2t fwidth x))) ]
> repaint f
> ]
>
>
> return ()
> where
> start_ul =3D (Pt (-4) 2)
> start_lr =3D (Pt 2 (-2))
> fwidth =3D 800
> fheight =3D 600
>
> When leftKey is pressed, this is supposed to set the mutable variable c=
s
> and repaint f. This doesn't work for some reason. However, if I try the
> same with a timer, it works:
>
> t <- timer f [interval :=3D 50
> , on command :=3D do set cs [value :~ \x -> (csys_shift_x =
x
> (-(fac_x_p2t fwidth x))) ]
> repaint f
> ]
>
>
> Any ideas?
> Thanks,
>
> - Fabian Yamaguchi
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> _______________________________________________
> wxhaskell-users mailing list
> wxh...@li...
> https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
>
|