Re: Help me with creating menus !!!
Re: Help me with creating menus !!!
- Subject: Re: Help me with creating menus !!!
- From: Hasan Diwan <email@hidden>
- Date: Thu, 7 Aug 2003 08:23:04 -0700
Manish:
I don't know Cocoa-Java that well. However, in Objective-C, you do
the following to get the File menu:
[[NSApp mainMenu] itemWithTitle:@"File"];
Of course, I'm certain it's safer to use the tag for it, but I
don't know what that would be off the top of my head.
For having it open a dialogue box:
// assume your dialogue box is in foo.nib
- (void)awakeFromNib {
// rest of your crud
[[[NSApp mainMenu] itemWithTitle:@"Help"] addItemWithTitle:@"Get
help" action:@selector(showFoo:) keyEquivalent:@""]; // you must not
use keyEquivalent:nil as it will crash your code
}
- (void)showFoo:(id)s {
[NSBundle loadNibNamed:@"Foo" owner:self];
[dialogueBoxWindow makeKeyAndOrderFront:self];
}
Java should not be too different, except for the syntax.
On Wednesday, Aug 6, 2003, at 20:05 US/Pacific, Manish Jamadagni wrote:
I am a newbie on macintosh platform. I am trying to create a
application
which has menus with some application specific submenus.
for eg - clicking on a particular submenu opens a new dialogue
box....how do
I do this in a cocoa-java application using the interface builder.
Hasan Diwan {
http://ibn.com/~hdiwan}
OpenPGP Fingerprint: 275D 0E84 550C D92A 4A56 732C 8528 2579 E6E9 4842
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.