Questions tagged [nsmenu]

OS X API : A class that defines an object that manages an application’s menus

365 questions
37
votes
3 answers

How does Apple update the Airport menu while it is open? (How to change NSMenu when it is already open)

I've got a statusbar item that pops open an NSMenu, and I have a delegate set and it's hooked up correctly (-(void)menuNeedsUpdate:(NSMenu *)menu works fine). That said, that method is setup to be called before the menu is displayed, I need to…
Aaron
  • 4,634
  • 1
  • 27
  • 43
29
votes
2 answers

How to access the system selected menu item blue color?

I'm working on an app that has a custom NSView on a NSStatusBar which performs all of the drawing when the user clicks it. But here's the problem, the color I'm currently drawing as the view's background color is not the same as the system blue…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
23
votes
8 answers

Cannot seem to setEnabled:NO on NSMenuItem

I have subclassed NSMenu and connected a bunch of NSMenuItem's via Interface Builder. I have tested via the debugger to see that they really get initialized. The menu is set to not auto enable items. Still when I set any of my NSMenuItem's to…
Christoffer
  • 25,035
  • 18
  • 53
  • 77
20
votes
6 answers

How do I disable the Show Tab Bar menu option in Sierra apps?

I've got an app that uses a Toolbar in a NSWindow. I don't want users to be able to customize this toolbar for aesthetic reasons. In Sierra there's a new Menu option that gets inserted into "Menu > View" called Show Tab Bar. How do I disable this?…
strangetimes
  • 4,953
  • 1
  • 34
  • 62
19
votes
1 answer

Gap above NSMenuItem custom view

I am using the setView: method on an NSMenuItem to set a custom view. In this custom view there is an image which takes the whole of the view. The NSMenuItem with this custom view is the first in the menu but the problem is it doesn't sit flush with…
Joshua
  • 15,200
  • 21
  • 100
  • 172
16
votes
4 answers

How i can get the Application Menu in Cocoa

How can I get the NSMenu or NSMenuItem for the application menu (the one in the menu bar next to the apple menu). It seems to be automatically created and independent from the NSMenu I set via NSApplication setMainMenu. By the way: I'm building my…
Lothar
  • 12,537
  • 6
  • 72
  • 121
15
votes
1 answer

Creating NSMenu with NSMenuItems in it, programmatically?

First, I'd like to point out that this question is probably already asked, I just couldn't find any answers from them. So, I'm programmatically trying to create a NSMenu and NSMenuItem to the main bar, so fe. NSMenu would be File and then it would…
user1632861
12
votes
4 answers

NSButton with delayed NSMenu - Objective-C/Cocoa

I want to create an NSButton that sends an action when it is clicked, but when it is pressed for 1 or two seconds it show a NSMenu. Exactly the same as this question here, but since that answer doesn't solve my problem, I decided to ask again. As an…
Alex
  • 5,009
  • 3
  • 39
  • 73
12
votes
3 answers

System is adding unwanted items to my customized contextual menu in my app

I have customized the contextual menu for my Cocoa application such that only certain items are visible. In spite of my customization, I found that the system adds a menu item -- "Add to iTunes as a spoken track". I tried removing this item from…
Prashant
  • 2,190
  • 4
  • 33
  • 64
12
votes
5 answers

Is there a way to control the NSMenuItem item that is initially highlighted when opening a menu?

I'm working on the details of a symbols pop up button, similar to what Xcode 3 at the top of its editor window. My controller object is the delegate of the NSMenu that is shown when the NSPopUpButton is shown. I implement the two methods…
willbur1984
  • 1,418
  • 1
  • 12
  • 21
11
votes
1 answer

NSMenuItem with custom view doesn't receive mouse events

I'm working on a menu bar app, and I'm setting a custom view using NSMenuItem's view property. The view displays ok, but I'm unable to receive any kind of mouse click events for menu items that have open submenus. In this screenshot, I've added a…
SteveB
  • 351
  • 1
  • 4
  • 15
11
votes
3 answers

NSMenu programmatically select item

I'm writing a plugin for application - custom keyboard shortcut. I can traverse through its views. I need to open popup menu, select item in it, then open its submenu and select some item in submenu. For now I'm only able to open top popup menu by…
cody
  • 3,233
  • 1
  • 22
  • 25
11
votes
0 answers

Overriding the keydown behavior of an active NSMenu

Wondering if anyone can help out with this doozy. I've got an NSMenu hosted by an NSStatusItem in the system status bar. For various reasons, I'd like to over-ride the default keydown behavior of the NSMenu, which is called "type-select".…
Alec Sloman
  • 699
  • 4
  • 18
10
votes
1 answer

Determine whether an NSMenu is opened

I have an NSMenu which opens when a user clicks an NSStatusItem in the status bar. How can I determine if the NSMenu is opened (expanded) or not? Thank you!
Knodel
  • 4,359
  • 8
  • 42
  • 66
10
votes
1 answer

How to customize NSMenu like the Apple Pro Apps?

I want to customize a NSMenu with NSMenuItems, so does it looks like the Apple Pro Apps. But how can I customize a NSMenu? There is no draw method to change the appearance. If I set a NSView to a NSMenuItem, I can set the background color, but I…
Matt
  • 448
  • 5
  • 16
1
2 3
24 25