I'm wrestling with NSPathControl. Specifically, I have a dialog (generated by a NIB) which asks the user for a title and a path. The path is supposed to be a local path on the user's hard drive. So, in Xcode 4, I dragged in an NSPathControl. In the Attributes inspector, I set its style to "Pop Up".

This pretty much works like I expect. If I click it, I get a menu with a few common paths or paths related to the current selection, and a "Choose..." option which opens up a dialog box and allows a path selection.

The problem is, it doesn't look like a Cocoa dropdown, because there's no border or button stuff at all. How can I make this look more like an NSPopUpButton, which is presumably what someone would expect.

Alternatively, I'm new to Cocoa and willing to be told I'm going about this the wrong way. If I'm going about it the wrong way, what's a better way to go about having the user select a path?

Here's an example of what I'm trying to do:

Example

See the path dropdown? I would have expected it to look like one of these...

Dropdown

...but, that said, I'm trying to write a well-behaved Cocoa app, so what I really want is, "What's the right way to do this?" Thanks in advance.

有帮助吗?

解决方案

The way I've done this before is by recreating the control myself using a highly customized NSPopUpButton. I don't know of a better way. You should ask for one.

其他提示

I tried with something and here is the result. Download Running Model.

this can be a hack or tweak, what to say I dont know

This is NSPathControl+NSButton Giving you a look-feel of NSPopUp.

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top