App Not Getting Input When Run

From WxWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

When run, your wxMac application doesnt accept mouse or keyboard input.

I'm no Mac developer, I come from wxWin. So I've been searching the Wiki, and asking pretty basic questions on the list.

Today I was stumped. I had a valid executable, but when I ran it, I got a wxMessageDialog I was looking for, but I could not hit the OK button, nor could I bring the window to the front.

A quick question on the list got me this reply:

-= paste =-

You _must_ create a bundle for Carbon and Cocoa apps on OS X.

If your binary is named "foo" then this works for testing purposes (don't ship like this): mkdir -p foo.app/Contents/MacOS mv foo foo.app/Contents/MacOS

When you get things working you can eventually tweak your build system to make the bundle before the final link step and pass -o foo.app/Contents/MacOS/foo to the linker rather than plain -o foo.

-= /paste =-

So, I created the *.app/Contents/MacOS directory, and changed my -o target to that directory. wxMac application now runs fine.

For a Makefile that automates this, see This discussion at the wxWidgets web forum