OSX menus

Hi, thanks for your help before. My app is running. (mostly)

I’ve been going a little nuts trying to put the original menus back in to my
carbon osX app. How is this done? When I enable SDL_USE_NIB_FILE and
supply a .nib, I get an error saying: Unable to load nib file: main, exiting.
I’m pretty clueless when it comes to cocoa and trial-and-error is going
nowhere fast.

There’s also no response to cmd-Q, shouldn’t that be handled by the cocoa
framework? It looks as though the input events are intercepted prior to
reaching cocoa’s handlers. How do I receive the menu events?

If I can get past this last dreg of cocoa I should be able to see the light at
the bottom of the cup.

Chris

Chris Ball wrote:

I’ve been going a little nuts trying to put the original menus back in to my
carbon osX app. How is this done? When I enable SDL_USE_NIB_FILE and
supply a .nib, I get an error saying: Unable to load nib file: main, exiting.

Works here. I’m not sure if it’s supposed to work with any old nib, if
that’s what you mean by a nib, but it works with the SDLMain.nib.

There’s also no response to cmd-Q, shouldn’t that be handled by the cocoa
framework? It looks as though the input events are intercepted prior to
reaching cocoa’s handlers.

That’s true (for key events). Looking at the source (QZ_DoKey() in
SDL_QuartzEvents.m), is seems that you can change that by setting the
SDL_ENABLEAPPEVENTS environment variable. The other solution is handling
the cmd-Q press “manually” in your SDL event loop.

How do I receive the menu events?

The usual way: add a -(IBAction)blah:(id)sender method to the SDLMain
class, re-read its header file in Interface Builder, and make a
target/action connection from the menu item to that method of the
SDLMain object in the nib.

If you need more detailed instructions, just ask, but I think there’s no
way around learning a bit about Cocoa for what you’re trying to do. (Or
maybe use SDL’s Carbon backend, but I don’t know anything about that.)

-Christian

Found it! (SDLMain.nib, etc.)

Looks like I downloaded the non-devel package.
:stuck_out_tongue:
Good thing there’s no such thing as a stupid question or I’d be in trouble.

Thanks again
Chris

OK, I’ve tried everything and I still can’t get past the runtime error:

[784] Unable to load nib file: main, exiting

I have a main.nib and the SDLMain.nib in there. How can it fail to find them?
This problem is absurd but I’m truly stuck.

Chris Ball wrote:

OK, I’ve tried everything and I still can’t get past the runtime error:

[784] Unable to load nib file: main, exiting

I have a main.nib and the SDLMain.nib in there. How can it fail to find them?
This problem is absurd but I’m truly stuck.

Sounds like you have your main.nib set as the “Main Nib File” in the
"Properties" tab of the target info window, is that so? Try changing
that setting to “SDLMain”.

(That’s assuming you’re using Xcode. If not, edit your info.plist.)

-Christian

After re-creating the project, everything started to function correctly.
I was advised to try this by an associate, this is certainly a projectbuilder
bug.

I’m now in the clear 100% (if that doesn’t jinx me nothing will).

Thanks Christian and everyone for your patience and advice.

Chris