Questions tagged [nsmenuitem]

The NSMenuItem class from AppKit.framework in Mac OS, defines objects that are used as command items in menus.

The NSMenuItem class defines objects that are used as command items in menus. Additionally, the NSMenuItem class also includes some private functionality needed to maintain binary compatibility with other components of Cocoa. Because of this fact, you cannot replace the NSMenuItem class with a different class. You may, however, subclass NSMenuItem if necessary.

Prior to Mac OS X v10.5, NSMenuItem conformed to the following protocols: NSCopying, NSCoding), and NSValidatedUserInterfaceItem.

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html

331 questions
0
votes
1 answer

NSMenuDelegate questions

I have an NSMenu which contains both static and dynamically created NSMenuItem's (static meaning NSMenuItem's created in Interface Builder, dynamic meaning NSMenuItem's created at run-time). Although I'm developing on 10.6, my application also…
ndg
  • 2,585
  • 2
  • 33
  • 58
0
votes
2 answers

How to get NSString value from NSPopupButton dropdown list?

Get username values from sqlite db. -(NSArray*)getUname { NSArray *resul = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error]; NSArray *fetchedRecords = [resul valueForKey:@"uName"]; } Insert this array values into…
cloudVision
  • 279
  • 1
  • 12
0
votes
1 answer

Can I conditionally disable an NSMenuItem that is only enabled when the first responder responds to a selector?

I have an NSMenuItem that is enabled/disabled based on whether or not the first responder responds to a specific selector. My problem is that there are conditions in which I do not want the item enabled for the first responder. But I can't just…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
1 answer

How can I get the Application Menu in Carbon?

How may I get the NSMenu for the application menu (the one in the menu bar next to the apple menu). This doesn't work on my old carbon app, mainMenu returns nil. NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; NSMenu *appMenu =…
subzero
  • 3,420
  • 5
  • 31
  • 40
0
votes
2 answers

Detect click on context menu osx

How can I make sure a method gets called each time I expand a NSMenu. I have tried connecting the action from storyboard but the action only seem to get fired when i click menu items, not the menu itself. [item setAction: @selector(play:)] I would…
David Karlsson
  • 9,396
  • 9
  • 58
  • 103
0
votes
1 answer

Flickering on NSSearchfield in NSMenu on status menu item

I am developing a menubar application in which i have used serachfield in NSMenuItem on status bar menu . When app launches . if we open first time menu on status bar then Searchfield flickers strangely , after that every time it is ok .
Ashish
  • 25
  • 8
0
votes
1 answer

Swift: How can I update NSMenuItem while it is active (visible)?

I created a simple timer which updates a counter within a NSMenuItem. func timerUpdate(){ dispatch_async(dispatch_get_main_queue()){ // calculating time let timeLeft = self.lxTimeLeft() // returns a double of remaining seconds …
ixany
  • 5,433
  • 9
  • 41
  • 65
0
votes
1 answer

Cocoa: Changing object property from different menu items

What's the rule of thumb if I want to change observed object's single property from different menu items (think - list of options). E.g. I have an app that displays a car in a single window. I have a menu with menu item that says [Colors] with few…
Eimantas
  • 48,927
  • 17
  • 132
  • 168
0
votes
0 answers

Errors in dynamically inserting NSMenuItem in the main menu of cocoa app

I want to insert dynamically NSMenuItem in the main menu of cocoa application on top.I am using following code. NSMenu *newMenu; NSMenuItem *newItem; newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]initWithTitle:NSLocalizedString(@"Language",…
Faisal Ikwal
  • 703
  • 3
  • 8
  • 25
0
votes
2 answers

NSSearchField Category Menu State

I have an NSSearchField control where I want to show a few categories that are to appear as a menu when the user clicks on the arrow to the left. After reading Apple's documentation, I have gotten some idea. The following is my code. //…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
0
votes
1 answer

NSMenuItem not responding to setIndentationLevel:

If I call setIndentationLevel: on an NSMenuItem then nothing happens, if I call indentationLevel on it after I set it to 3, it returns 3 like it should. I'm adding the menu items to the Dock menu and I don't see anything changing. NSMenuItem…
Jef
  • 297
  • 5
  • 15
0
votes
1 answer

How to relate the states of several NSMenuItems, so that they are mutually exclusive?

What is the best way to relate the states of several NSMenuItems as seen in many application’s View → Sort By menus, so that they are mutually exclusive? Here a screenshot from Mail as example: I found the following passage in the documentation but…
MartinW
  • 4,966
  • 2
  • 24
  • 60
0
votes
2 answers

NSMenu click in OS X

How can I detect when the menu in menu bar is clicked? I mean when whatever is clicked like for example "file" menu not a concrete position in the menu. I tried to connect IBActions from menu items in interface builder from my code, but it does not…
Wojtek
  • 1,006
  • 11
  • 30
0
votes
1 answer

NSMenu problems showing/hiding HUD NSPanel

Still having great difficulty with this problem. Any suggestions? I cannot find a simple tutorial online that explains the basics of NSPanel windowing as different from NSWindow. I have an HUD window that I'd like to show as a notification & input…
Andrew J. Freyer
  • 591
  • 2
  • 12
  • 38
0
votes
2 answers

NSMenuItem target not visible in nib

I have an NSMenuItem that I want to connect to an IBAction. The IBAction is in an NSViewController subclass. There's no direct link to that subclass from MainMenu.xib, so I can't choose it as a target for the NSMenuItem. The only actions I can…
jsd
  • 7,673
  • 5
  • 27
  • 47