如何使NSPathControl看起来像其他下拉框? [英] How do I make an NSPathControl look like other dropdown boxes?

查看:625
本文介绍了如何使NSPathControl看起来像其他下拉框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我摔跤的 NSPathControl 。具体来说,我有一个对话框(由NIB生成),询问用户的标题和路径。该路径应该是用户硬盘驱动器上的本地路径。因此,在Xcode 4中,我在一个 NSPathControl 中拖动。在属性检查器中,我将其风格设置为弹出。

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.

问题是,它看起来不像Cocoa下拉列表,因为没有边框或按钮的东西。我如何使这个看起来更像一个 NSPopUpButton ,这可能是人们期望的。

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.

对Cocoa来说是新的,愿意被告知我要走这条路。如果我以错误的方式走,什么是一个更好的方式来让用户选择一个路径?

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?

这里是一个例子,我试图do:

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

查看路径下拉菜单?我希望它看起来像这样的一个...

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

...但是,我想写一个行为良好的Cocoa应用程序,所以我真正想要的是,什么是正确的方法这样做?提前感谢。

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

推荐答案

我之前的做法是通过使用高度自定义的 NSPopUpButton 。我不知道一个更好的方法。 您应该要求一个。

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.

这篇关于如何使NSPathControl看起来像其他下拉框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆