nsmenu

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 will loose highlighting and menu handling. Furthermore the top and bottom cap of the NSMenu...

Alternative Menu Items in NSMenu

Hi, I have an NSMenu that contains NSMenuItems with custom views. I want it so that when the alt button is pressed, the menu items would change part of their look (through their view). I found setAlternative in the NSMenuItem docs, however, in practice I could only get it to work with NSMenuItems without custom views. As soon as I se...

First item in an NsMenu does not appear to show up (cocoa osx)

I am making my own NSMenu programatically and popping it up when a button is pressed. I create NsMenuItems and add them with the NSMenu method insertItem:atIndex:. For some reason whatever item is at position zero in the menu does not show up. Is this how the menu is supposed to work? ...

Usable mainmenu when sheet is shown

How does one react to menuitems that are clicked via mouse or invoked via keyboard, e.g: CMD+Q ? [NSApp beginSheet:my_sheet ...arguments... ]; /* The sheet is now shown and the mainmenu isn't usable. How does one make it usable? */ [NSApp endSheet:my_sheet returnCode:0]; ...

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 submenu items like [Black, Green, Blue, Red, White, etc.]. How do I implement the mechanis...

Add a Contextual Menu to WebView

An easy one, I think: I want to add a contextual menu to a WebView. In IB, I added a NSMenu to the NIB, connected it to the WebView's menu outlet, launched and expected to be able to control-click in the WebView and see the pop-up menu. The only item I saw on the contextual menu is "reload". I can do the same steps but connect the ...

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 listen for that and trigger an asynchronous request, later updating the menu while it is open, ...

NSMenu doesn't start tracking

Hey, I have a little cocoa app which usually operates in the background (as agent). Sometimes I'd like to be able to popup a contextmenu (no window or s.th. visible at this time). As I'm only targetting Snow Leopard I tried this: if (windows) { NSMenu *theMenu = [[[NSMenu alloc] initWithTitle:@"test"] autorelease]; [theM...

How can you update an NSMenu while it is active (visible)?

I have an NSMenu instance, through which all communication with the Cocoa app will take place. If the menu is open, the background doesn't run, so how can I force an update while the menu is still active? ...

Ellipsizing an NSMenuItem's title to the width of the menu

I want to programatically change an NSMenuItem's title, but ellipsize it so that this modification never causes the menu to increase in width. how can i do this? ...

NSMenuItem number bubble?

I have seen something like this: in a Menulet on the right of menu items and I can't figure out how to do it. Can anyone elaborate? Thank you! ...

Selecting the first item in a popUpContextMenu

I work on a very keyboard intensive application. Both hands on the keyboard. No hands on the mouse. A user can, via the keyboard, popup a context menu, select an item and finally hit enter. [NSMenu popUpContextMenu] displays the menu without highlighting any item. The user will have to press arrow_down one time in order to highlight th...

popup menu calling for update of all menus on each keypress

I'm creating a pop up menu programmatically and updating it with the delegate method menuNeedsUpdate:(NSMenu *) menu and then displaying it using the popUpMenuPositioningItem:nil atLocation:mouseLoc inView:nil method. It works fine as far as mouse control is concerned. However, when using the keyboard (letters or arrow keys), I've notic...

How force NSMenuItem to redraw?

Hi, I'm implementing a custom status bar menu, which has a custom view with NSSearchField. I'm updating number of menu items according to search results. The number of menu items is changed as user types in the NSSearchField. I've noticed, that if number of results stays the same, items titles are not updated (redrawn). How do I force t...

How to create NSButton with delayed NSMenu ?

Hi, In Cocoa i want to create an nsbutton with delayed menu. i.e., When clicked it should call the action method and when kept in pressed state for 2 seconds it should display a nsmenu. It is similar to "Build Active Target" button present in Xcode toolbar. Regards, Dhanaraj. ...

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 complete application without XCode, so please no InterfaceBuilder tips. PS: MacOSX 10.5 ...

Sharing NSMenuItems across multiple NSMenus...

Hi, I've got multiple menus in the same application and would like to share submenus between them. For simplicity's sake, let's say one is the main menu, the other the dock tile menu.. I've got submenus that contain quite a few items (let's say font names), many of which I need to keep an iboutlet reference to for various reasons. In...

how to set focus on NSMenu (make it get key events)?

I have a status menu with a NSSearchField and menu items. When search field is active and user presses up & down arrows, I'd like to start menu tracking, that is that the user will be able to move with arrow keys between menu items. I can catch moveUp and moveDown selectors. How can I cause the menu to become a key responder? Thanks, N...

Sync state of two NSMenuItems

Hi, I have two NSMenus with the same NSMenuItems. Only one NSMenuItem in its NSMenu should be selected. (Kind of like an NSMatrix). So I connected each NSMenuItem to the same action and added an iVar for the index of the item with the NSOnState. Inside the method I set the state of the item with the old index to NSOffState and the new o...

Displaying custom/arbitrary controls in an NSMenu

How can I Display an NSTextField or an NSProgressIndicator within an NSMenu? I'm looking to do something similar to the Spotlight icon menu, or the Help menu of most applications. ...