Hi Abraham,
Abraham Egnor wrote:
> I'm a newb to both wxHaskell and wxWindows, so I apologize if I've
> missed something obvious.
>
> The following program constructs a trivial menu and submenu; the
> command for the non-submenu item works but the one for the submenu
> item does not.
You have found a bug :-) Fortunately, there is an easy work-around:
just change the order of the "menuSub" call and the "menuItem" call:
> m <- menuPane [text := "Menu"]
> sub <- menuPane []
> menuSub m sub [text := "Submenu"]
> menuItem sub [text := "Test", on command := putStrLn "Test"]
> menuItem m [text := "Test 2", on command := putStrLn "Test 2"]
Another workaround is to catch the menu events in the frame (or current
window):
> m <- menuPane [text := "Menu"]
> sub <- menuPane []
> menuSub m sub [text := "Submenu"]
> test <- menuItem sub [text := "Test"]
> menuItem m [text := "Test 2", on command := putStrLn "Test 2"]
> ...
> set f [on (menu test) := putStrLn "Test"]
I have fixed the bug in CVS, but I guess that the
workaround is convenient enough for now.
Thanks for pointing this out,
All the best,
Daan.
This was tested under debian unstable, with wxHaskell
> 0.8 and wxGTK 2.4.2.
>
> Abe
>
> import Graphics.UI.WX
>
> main = start gui
>
> gui =
> do f <- frame [text := "Submenu test", visible := False]
>
> m <- menuPane [text := "Menu"]
> sub <- menuPane []
> test <- menuItem sub [text := "Test", on command := putStrLn
> "Test"] -- doesn't work
> menuSub m sub [text := "Submenu"]
> menuItem m [text := "Test 2", on command := putStrLn "Test 2"] -- works
>
> set f [menuBar := [m]]
> focusOn f
> set f [visible := True]
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by OSTG. Have you noticed the changes on
> Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
> one more big change to announce. We are now OSTG- Open Source Technology
> Group. Come see the changes on the new OSTG site. www.ostg.com
> _______________________________________________
> wxhaskell-users mailing list
> wxh...@li...
> https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
>
>
|