简体   繁体   English

NSComboBox进入NSAlert

[英]NSComboBox into NSAlert

First of all I'm kind of new in Objc. 首先,我是Objc的新人。 (so try to explain me like. . . for dummies XD) Well my question is: Is there any way to show a NSComboBox inside a NSAlert? (所以试着向我解释......对于傻瓜XD)我的问题是:有没有办法在NSAlert中显示NSComboBox? that's it! 而已! I've check the documentations, an it says that it is possible to show a NSTextView, but I'm wandering if anyone has done this before (with the NSComboBox), a code example would be really useful! 我检查了文档,它说有可能显示NSTextView,但是如果有人之前已经这样做了(使用NSComboBox),我会徘徊,代码示例真的很有用!

Thank's in advance!!! 提前致谢!!!

You might want to read the documentation on setAccessoryView: and layout at this URL . 您可能希望阅读有关此URL的 setAccessoryView:layout的文档。 I don't know if you can insert a combobox there and if you can somehow get a return from it. 我不知道你是否可以在那里插入一个组合框,如果你能以某种方式从中获得回报。

Eureka!!! 尤里卡!

is really simple, you just have to remember that NSButton, NSTextField, NSComboBox. 很简单,你只需要记住NSButton,NSTextField,NSComboBox。 . . (etc) inherits from NSView so, you just need to send the object you need into your NSAlert like this: (等)继承自NSView所以,你只需要将你需要的对象发送到NSAlert中,如下所示:

[specialtyAlert setAccessoryView:specialtyOptions];

where specialtyAlert is an instance of NSAlert, and specialtyOptions is an instance of NSComboBox (but it could be an instance of NSButton or any other GUI object). 其中,specialAlert是NSAlert的一个实例,而specialOptions是NSComboBox的一个实例(但它可以是NSButton的实例或任何其他GUI对象)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM