• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: get a window in front by clicking on a menu item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >get a window in front by clicking on a menu item (From: Martin Batholdy <email@hidden>)
 >Re: get a window in front by clicking on a menu item (From: Alexander Spohr <email@hidden>)
 >Re: get a window in front by clicking on a menu item (From: Alexander Spohr <email@hidden>)
 >Re: get a window in front by clicking on a menu item (From: Martin Batholdy <email@hidden>)
 >Re: get a window in front by clicking on a menu item (From: Alexander Spohr <email@hidden>)

  • Prev by Date: Re: get a window in front by clicking on a menu item
  • Next by Date: Getting a frame number in a QTMovieView/QTMovie
  • Previous by thread: Re: get a window in front by clicking on a menu item
  • Next by thread: Re: get a window in front by clicking on a menu item
  • Index(es):
    • Date
    • Thread