You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See example code below. Running this program with any command line args that cause WX's 'start' to be run (in this case, anything other than "terminal"), results in a crash, with a popup error window complaining about an 'unexpected parameter'.
gui = do fr <- frame [text := "GUI calculation"] t <- staticText fr [text := "Enter a number below"] n <- entry fr [] let foo = do v <- read <$> get n text set t [text := "Your number * 3 is " ++ show (v * 3 :: Int) ] b <- button fr [text := "Calculate", on command := foo] set fr [layout := column 3 [widget t, widget n, widget b] ]
terminal = do putStrLn "Enter a number" v <- read <$> getLine putStrLn $ "Your number * 3 is " ++ (show $ v * 3)
main = do a <- getArgs case a of ("terminal"):_ -> terminal ("gui"):_ -> start gui _ -> start gui
I've gone as far as rewriting Graphics.UI.WXCore.Event.appOnInit, which appears to be responsible for passing command line args to the rest of the wx initialization code. In my test case in the code linked above, the rewritten version assures that no args are passed to the new appOnInit, and yet the program still crashes with the same error, with WX still somehow able to see the command line args, despite the args not being passed to (the new version of) 'start', 'run' or 'appOnInit' explicitly.
The text was updated successfully, but these errors were encountered:
kowey
pushed a commit
to kowey/wxHaskell
that referenced
this issue
Oct 3, 2017
See example code below. Running this program with any command line args that cause WX's 'start' to be run (in this case, anything other than "terminal"), results in a crash, with a popup error window complaining about an 'unexpected parameter'.
import Graphics.UI.WX
import System.Environment (getArgs)
gui = do
fr <- frame [text := "GUI calculation"]
t <- staticText fr [text := "Enter a number below"]
n <- entry fr []
let foo = do
v <- read <$> get n text
set t [text := "Your number * 3 is " ++ show (v * 3 :: Int) ]
b <- button fr [text := "Calculate", on command := foo]
set fr [layout := column 3 [widget t, widget n, widget b] ]
terminal = do
putStrLn "Enter a number"
v <- read <$> getLine
putStrLn $ "Your number * 3 is " ++ (show $ v * 3)
main = do
a <- getArgs
case a of
("terminal"):_ -> terminal
("gui"):_ -> start gui
_ -> start gui
I've gone as far as rewriting Graphics.UI.WXCore.Event.appOnInit, which appears to be responsible for passing command line args to the rest of the wx initialization code. In my test case in the code linked above, the rewritten version assures that no args are passed to the new appOnInit, and yet the program still crashes with the same error, with WX still somehow able to see the command line args, despite the args not being passed to (the new version of) 'start', 'run' or 'appOnInit' explicitly.
The text was updated successfully, but these errors were encountered: