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

How to set the number of displayed items of NSMenu?

As the title mentioned. I implemented an combo-box-like NSMenu object. But I wonder how to set the number of displayed items. Like the method of NSComboBox: -setNumberOfVisibleItems: Could any one tell me?
Andrew Chang
  • 1,289
  • 1
  • 18
  • 38
0
votes
1 answer

How to pop-back NSMenu object?

As widely known, we can pop up programmatically an NSMenu object by calling -popUpContextMenu:... method. However, I wonder how to pop the menu object back programmaticaly.
Andrew Chang
  • 1,289
  • 1
  • 18
  • 38
0
votes
1 answer

Which NSTableView receives NSMenuItem?

I have a custom NSViewController with two NSTableViews side-by-side, something like a split-view setup where the selection on the left tableView changes the right tableView's list. I'm not sure how to handle NSMenuItem events in this case. For e.g.…
Z S
  • 7,039
  • 12
  • 53
  • 105
0
votes
1 answer

How to prevent the keyEquivalent from showing in an NSMenuItem

So I've set up an NSPopUpButton menu and populated it with the menu items and set all the key equivalents to what I want. The problem I'm having is that it automatically displays the key equivalent in the menu items next to the title of the item…
nonex
  • 233
  • 3
  • 12
0
votes
0 answers

MenuItem attached menu-items turn gray

I have a MenuItem with attached NSMenu to it. To the NSMenu, items are added with target/action etc. Everything works great, the software runs perfect, the menu appears with the items, and they are enabled and perform their action. But, 1 to 100…
eyalw
  • 730
  • 7
  • 22
0
votes
1 answer

Input in menu item?

I would like to know if it is possible to have a NSTextField (for example) as a menu item in a menu. Your help will be very appreciated! Sweet day, —Albé
Donovan
  • 6,002
  • 5
  • 41
  • 55
0
votes
0 answers

Main Menu disconnected

I have been working on a Cocoa app that has been working great until today for some reason the all of the items in the Main Menu has become disconnected form their actions. Is there a simple setting I accidentally clicked upon that would do this? …
Andrin
  • 425
  • 1
  • 4
  • 15
0
votes
2 answers

Remove Dictation and Special Characters menu options from NSMenu

I have a weird "bug". I'm creating an "Edit" menu for my Mac OSX application. It shall contain copy, paste, select all et.c. I have solved the functionality by simply connecting the appropriate selectors in the first responer to the menues. I…
Sunkas
  • 9,542
  • 6
  • 62
  • 102
0
votes
1 answer

User define key equivalents

I would like to allow the user to create their own key equivalents. Below is a snap of the prefs page in Google Voice as an example. I'm stumped on how to record the shortcut in a field as shown below. I've yet to find an example or any help on…
vcirilli
  • 321
  • 3
  • 13
0
votes
2 answers

Rebuild NSMenuItems in StatusBar

I'm trying to have a dynamic number of NSMenuItems in a Statusbar app. Right now I'm reading in a list in the awakeFromNib. But this only happens once. What do I have to do to rebuild my NSMenuItems while the applicaiton is running? Should it happen…
fabianmoronzirfas
  • 4,091
  • 4
  • 24
  • 41
0
votes
2 answers

ValidateMenuItem is not getting called for NSMenuItem

Here is my sample class and usage: @interface CCocoaMenuItem : NSMenuItem { someClass *someobj; } - (void)menuEventHandler:(id)target; - (void)setEnableItem:(BOOL)nEnabled; @end @implementation CCocoaMenuItem -…
test
  • 123
  • 6
0
votes
1 answer

XCode display a project image in the credits.rtf file

I want to take an image from my project and add it to the "About MyApp" window. This seemed as simple as adding the image to the credits.rtf file; once I dragged and dropped the image from the project to the credits.rtf file, it inserted the image…
Liftoff
  • 24,717
  • 13
  • 66
  • 119
0
votes
2 answers

NSEvent click right menu

I use this code to have two different behaviors when click right or left on menu. Click left and click right + cmd. How can I right click without pressing cmd + click in the simplest way? -(void)awakeFromNib { NSImage *image = [NSImage…
Joannes
  • 81
  • 1
  • 11
0
votes
2 answers

NSMenuItem toggle Bold Font style

I have to implement NSMenuItem such a way that selected NSMenuItem should have Bold Text , this is what i have done, @implementation NSMenuItem (Font) -(void)setBoldStyle:(bool)bBold{ NSString* title = [self title] ; NSFont *pFont =…
Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
0
votes
0 answers

Populating NSPopupButton with Core Data Entity plus a menu Item

Is there a way to put the list of a core data entity into a NSPopupButton and additionally put a menu item there? I have two core data entities, say Person and Car. A Person has many Cars (relationship). On a sheet the user should be able to pick a…