Re: get a window in front by clicking on a menu item
Re: get a window in front by clicking on a menu item
- Subject: Re: get a window in front by clicking on a menu item
- From: Martin Batholdy <email@hidden>
- Date: Fri, 5 Jun 2009 23:40:37 +0200
[menuItem setTarget:myWindowOutlet];
[menuItem setAction:@selector(makeKeyAndOrderFront:)];
ok, that makes sense to me.
But now, the menuItem is inactive (so I cant click on it).
here my code;
hope someone can give me a clue what is wrong with the code...
AppController.h
#import "MenuHandler.h"
@implementation AppController
MenuHandler *menuCreate;
- (void) awakeFromNib {
menuCreate = [[MenuHandler alloc] init];
[menuCreate setIcon];
[menuCreate initItems];
return self;
}
And that happens when initItems get called;
MenuHandler.m
- (void) initOtherItems
{
// Edit-List-Button
//NSMenuItem *newItem;
newItem = [[NSMenuItem alloc] init];
[newItem initWithTitle:@"Preferences"
action:@selector(makeKeyAndOrderFront:)
keyEquivalent:@""];
[menu addItem:newItem];
[newItem setEnabled:YES];
[newItem setTarget:prefs];
[menu addItem:[NSMenuItem separatorItem]];
}
and prefs is defined in MenuHandler.m, and connected with the window
made in IB;
MenuHandler.h
@interface MenuHandler : NSObject {
NSMenu *menu;
NSMenuItem *newItem;
IBOutlet NSWindow *prefs;
}
- (void) initOtherItems;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden