On Thu, 22 Jan 2009 13:11:15 +0100, Günther Schmidt <[email protected]>
wrote:
Hi,
I have a ridiculously trivial problem, I can't seem to get creating a
bitmap button right with 3 images for the different states, active,
pressed, and inactive.
It just draws an "empty" space for the button on screen.
Günther
Maybe it is an image format that cannot be handled properly? Can you show
us the code you use?
I have attached a program that switches between three images for the
button, each time the button is clicked.
--
Regards,
Henk-Jan van Tuyl
--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--
RotatingButtonImage.lhs
2009-01-22
> import Graphics.UI.WX
> buttons :: [String]
> buttons = ["button62.gif", "button63.gif", "button64.gif"]
> main :: IO ()
> main = start $
> do
> f <- frame [ fontSize := 10 ]
> v <- varCreate 0
> ok <- bitmapButton f [ picture := buttons !! 0
> , text := "Ok"
> ]
> set ok [ on command := rotateImage v ok ]
>
> set f [ layout :=
> column 1 [ widget ok
> ]
> ]
>
> return ()
> rotateImage :: (Pictured w) => Var Int -> w -> IO ()
> rotateImage v ok =
> do
> v' <- varGet v
>
> if v' == length buttons - 1
> then varSet v 0
> else varSet v (v' + 1)
>
> -- Set a new button image
> v' <- varGet v
> set ok [ picture := buttons !! v' ]
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
wxhaskell-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users