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

AppArgs not working with wxMax #44

Open
peterigz opened this issue Nov 18, 2019 · 3 comments
Open

AppArgs not working with wxMax #44

peterigz opened this issue Nov 18, 2019 · 3 comments

Comments

@peterigz
Copy link

peterigz commented Nov 18, 2019

Hello, for some reason the AppArgs array seems to be getting erased when using wxWidgets. Maybe there's a way to access them via wxWidgets with argc/argv but I couldn't figure out how. For example, this works fine without importing wx mod:

SuperStrict

Print "Number of arguments = "+AppArgs.length

For Local a:String = EachIn AppArgs
    Print a
Next

But this doesn't:


Framework wx.wxApp
Import wx.wxFrame

Type MyApp Extends wxApp

	Field frame:wxFrame

	Method OnInit:Int()

		frame = wxFrame.CreateFrame(,,"Hello World", 100, 100)
		frame.show()
		
		Print "Number of arguments = "+AppArgs.length
		
		For Local a:String = EachIn AppArgs
		    Print a
		Next
	
		Return True
	
	End Method

End Type

New MyApp.run()

When launching each program on the command line with a few parameters, the first example returns all parameters fine, but the wx example only prints out 1 parameter (the command that executed the program)

It used to on previous versions of wxWidgets (or maybe previous MacOS version), but the latest versions seems to be affected. Not sure if this is a bug in wxWidgets or I just need to figure out where to get at the args in wxWidgets. This is on BlitzMaxNG MacOS Catalina. Thanks!

@GWRon
Copy link
Contributor

GWRon commented Nov 27, 2019

Do you have old builds of your application - and do they work? Maybe it is an issue introduced by Catalina and not the libraries/built binaries.

Regarding wxWidgets and AppArgs.

The AppArgs for BlitzMax should be filled/loaded before the actual program (so usage of wxApp) are started up:

blitz.mod - blitz_app.c

void bbStartup( int argc,char *argv[],void *dummy1,void *dummy2 ){
[...]
	bbGCStartup();
	bbThreadStartup();
[...]
	
	for( k=0;k<argc;++k ){
		BBString *arg=bbStringFromCString( argv[k] );
		BBINCREFS( arg );
		*p++=arg;
	}

So .. it should normally not be affected by some wxWidgets stuff at all.

@GWRon
Copy link
Contributor

GWRon commented Nov 27, 2019

You built a GUI application didn't you (not a "console" one - behaviour might change) ?

Maybe the wxApp instance now gets instantiated before bbStartup is run ?

Nonetheless "C wxApp" might provide access to argc and argv - but for now this is not exposed to the "Blitzmax wxApp". Maybe @woollybah could expose that - to for now allow a fallback to these arguments instead of the blitzmax ones.

https://docs.wxwidgets.org/3.0/overview_app.html

@peterigz
Copy link
Author

Thanks, yes both the examples I put above are built with gui mode, as soon as wxApp is imported I can't seem to get those args.

I think it probably is something to do with Catalina as it worked ok before I started building the 64bit version. What that thing is though I'm not sure. Also works fine on windows.

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

2 participants