nsmenuitem

How to draw my own key equivalents in NSMenuItem?

I would need something this owner drawn tab completition key equivalents in my own code. Like TextMate does in this example. I heared that the menu drawing is Carbon based but I don't hope it is such a huge hack. But whatever I tried and wherever I looked I couldn't find a clue. EDIT: I'm willing to accept even a carbon based answer,...

Custom NSView in NSMenuItem not receiving mouse events

I have an NSMenu popping out of an NSStatusItem using popUpStatusItemMenu. These NSMenuItems show a bunch of different links, and each one is connected with setAction: to the openLink: method of a target. This arrangement has been working fine for a long time. The user chooses a link from the menu and the openLink: method then deals w...

Change in vertical alignment of NSMenuItem

I've noticed that under MacOS 10.3.9 and 10.4.11, an NSMenuItem's attributed title is aligned with the top of its image. In other words, if the menu item's image is higher than its title, the title floats up to the top of the image. Under 10.6, an NSMenuItem's attributed title is aligned with the middle of its image. The title is vert...

What's the cleanest way to bind enumerated properties?

I have a menu which has an item for each value in an enum. The menu: [ ] Sort by Due Date [ ] Sort by Priority [√] Sort by Title The enum: typedef enum CW_TASK_SORT_METHOD { CWTaskSortMethodDueDate, CWTaskSortMethodPriority, CWTaskSortMethodTitle } CWTaskSortMethod; The property: @property(readwrite, assign) CWTaskSo...

Custom NSStatusItem with custom view - Use NSWindow, NSView, custom NSMenuItem?

I'm trying to create a LSUIElement app that behaves like Spotlight, CoverSutra and other apps of that type. I managed to create a custom NSStatusItem, which popups up an NSWindow but the problem is that the app that currently has focus will the focus to my custom NSWindow. I've based myself on Matt Gemmell's example (http://mattgemmell....

NSTextField in NSMenuItem

Hi am writing small app for posting twitts on twitter.com I manage to create statusbar icon next to clock and battery monitor, but now I am stacked... I wanted to add menu item text area max length of 140 chars, (4-5 rows text input field) something like spotlight but multi-rows (BTW I have got working class, to put and get twitts on t...

Input in menu item?

Hi! 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é ...

Adding item to NSMenu with action selector preset

I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add menu items to an NSMenu instance and have the items action selector already set upon insertion. I can, add the dynamic menu items fine, but the action selector doesn't trigger when the item is clicked via the menu. The first line below is the line of ...

NSMenuItem Text Field Highlight Problem

Hi, I am creating a Status Bar application which requires a URL being entered in a text field. The text field is a subview of the NSMenuItem. The problem I am facing though is that the value of the text field cannot be changed and only "indirectly highlighted" (it's not the normal blue highlighting but a grey one and only occurs when do...

Can't populate NSMenu from document controller

Hi all, I've a MainMenu.xib and a MyDocument.xib. I need to dynamically populate some NSMenuItem's from my document controller but I'm at a loss on how to get to it from MainMenu.xib. I've tried adding an NSObject to MainMenu.xib and make it an instance of my document controller but I can't populate the NSMenuItem's from the NSArrayCon...

Getting NSPopUpButton from NSMenuItem

Hi, My application uses the -validateMenuItem: method for validating menu items. But I need to validate different menu items depending on what popup's there in. I was hoping for a way to get the tag of the popup, but after looking through the docs I can't seem to find a way... any ideas? Thanks, Marcus Edit: I thought this needed som...

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 box, but I cannot for the life of me figure out how. My attempts are below. I know thi...

NSTableView and NSSearchField in an NSView, which is the outlet of an NSMenuItem, don't work

I'm having an NSView, which is set as the view: outlet of an NSMenuItem. The view contains an NSTableView (inside an NSScrollView) and an NSSearchField. The NSMenu is shown when the user clicks a specific NSStatusItem. When I launch the application from Xcode (Build and Run), the controls behave well, but whenever I launch it from the Fi...

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 *menuItem = [[NSMenuItem alloc] initWithTitle: @"title" action: nil keyEquivalent: @""]; [menuIt...

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? ...

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...

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, ...

How do I set the sender on a NSMenuItem's action?

The Apple documentation says that the sender passed to the NSMenuItem's action can be set to some custom object, but I can't seem to figure out how to do this. Is there a method I'm not seeing someplace in the documentation? ...