Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line Args broken #26

Open
blgeorge opened this issue Jul 14, 2016 · 0 comments
Open

Command Line Args broken #26

blgeorge opened this issue Jul 14, 2016 · 0 comments

Comments

@blgeorge
Copy link

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.

kowey pushed a commit to kowey/wxHaskell that referenced this issue Oct 3, 2017
Modify function name from 'wxSize_Destroy' to 'wxSize_Delete'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant