问题标签 [nscombobox]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
919 浏览

objective-c - NSComboBox - problems with background when selected

I'm a iOS developer, and recently I'm programming a desktop APP for MAC OSX. I still don't have much experience with the View's components of OSX, so maybe it's a silly or easy question, but I have made a little research about this problem and haven't found any solution yet.

Here's the problem:

I have a custom specialization of a NSView, that is used as the view of a Content ViewController used in my NSPopover.

Inside this view, that I'm calling "PopoverBackgroundView", I painted inside the drawRect this red background, and calculated another minor rect and painted with this gray-like color. Here's the code:

So, inside the PopoverBackgroundView.m I'm programatically creating a NSComboBox. This comboBox will have the numbers 1 to 10. When I allocate it, everything seems just fine:

enter image description here

The problem is, after I select any options inside the combobox, it's background somehow "goes away" became transparent, I don't know, and become like this:

enter image description here

Please notice the red-like frame (background color of the view) around the NSComboBox, that appeared just AFTER I select something.

Here's the code where I'm allocation the comboBox and initializing it:

Any idea how can I 'fix' this "selected background"? All that I want it's the selected state to be equals to the normal state, i. e. ,the comboBox should be always like the first image, even after the selection.

Is there something wrong with the allocation code? Something mission? I'm really thinking that just some property that I'm not using or initializing, but I couldn't find yet.

Thanks in advance,

0 投票
1 回答
221 浏览

objective-c - 为 NSComboBox 项目设置工具提示

我如何NSComboBox在鼠标悬停时显示项目的工具提示,因为它们太长而无法显示?我试过设置allow expansion tool tip ,但没有显示。对于 TableView 和提交的文本,这是有效的。那我能做什么?

0 投票
1 回答
393 浏览

objective-c - 以编程方式加载带有键/值(或绑定?)的 NSComboBox

我有一个加载了访问的 sqlite3 数据库,并试图将下表的内容放入 NSComboBox 中(然后根据其他操作参数自动选择默认键)。以下是表格内容:

目标是以某种方式(最好是在代码中,但如果我必须使用绑定,或者如果它被认为是更好的做法)将这些项目加载到 NSComboBox 中,如下所示:

我在某个时候创建​​了一个 BackupIncrement 类,其中包含 3 个公开的实例变量作为 incrementid、value 和 description 的属性。并且打算尝试加载一个 NSMutableArray 并尝试以编程方式将其链接为数据源,但我似乎无法让它工作。到目前为止,这是我的代码,您可以看到我一直在使用对象和可变数组的位置:

所以是的 - 非常感谢以编程方式或 XCode5 中的绑定进行此操作的任何帮助!谢谢!

0 投票
1 回答
123 浏览

cocoa - NSComboBox 的数据排序

全部,

在我的应用程序中,我需要使用 NSComboBox。组合框将显示的数据需要排序。

但是查看 Apple 文档,我看不到使控件具有 SORT 样式的方法。

任何熟悉 API 的人都可以为我指明正确的方向吗?

谢谢你。

0 投票
1 回答
410 浏览

cocoa - 绑定到 NSArrayController 的 NSComboBox 未更新

我对NSComboBox元素和NSArrayController.

所有绑定都在 IB 中设置。该NSComboBox元素具有以下绑定:

  • 内容:绑定到NSArrayController实例,键:arrangedObjects
  • 内容值:绑定到NSArrayController实例,键:arrangedObjects.name

元素通过NSArrayController以下方式绑定:

  • 内容数组:绑定到File's Owner,关键路径:(availableProperties这是一个NSMutableArray

在代码中,我有一个在窗口打开和某些事件触发后调用的方法。

代码如下:

(模型)在哪里,self.availablePropertiesNSMutableArrayself.availablePropertiesControllerNSArrayController

当窗口打开时,组合框已正确填充。但是当事件触发时,我执行上述语句,我可以看到支持数组正确填充,但组合框完全为空。

一些想法?

0 投票
1 回答
3732 浏览

macos - 关于自定义 NSComboBox 的任何示例?

我被要求实现这样的组合框:

在此处输入图像描述

很明显,这和 NSComboBox 有很大的不同
<1> 文本框旁边的按钮应该是自定义的
<2> 这更重要的是:还有一个额外的“十字”(这是一个表示“删除”动作的按钮) 在每个组合项目中。

我怎样才能达到这个效果?我搜索了互联网,但没有找到答案。谁能告诉我我应该做什么或告诉我任何子类化或自定义 NSComboBox 类的示例?

0 投票
1 回答
344 浏览

macos - 选择后如何使 NSComboBox 失去焦点?

我的 OSX 应用程序中有一个组合框,我希望它在更改值选择后立即失去焦点。

现在它只是在选择后保持选中并突出显示。

任何形式的帮助都非常感谢!

0 投票
0 回答
160 浏览

objective-c - Cocoa - 重新加载 NSComboBox (OSX)

::edit - 已解决.. 我没有正确遵守 NSComboBoxDataSource ..

我有一个可以工作的 NSComboBox 实现 - 除了 - 当数据源发生更改时,在重新启动应用程序之前,更改不会反映在组合框中。我到处都[myComboBox reloadData]抹了抹灰,但是没有效果。任何想法我应该寻找什么?

数据源在 IB 中标注:

实现了以下数据源方法:

0 投票
3 回答
955 浏览

cocoa - 如何处理这个长错误:此应用程序正在尝试绘制一个非常大的组合框

我在 SO 上找不到任何对此的参考。完整的信息是:

“这个应用程序正在尝试绘制一个非常大的组合框,高 32 磅。不支持垂直可调整大小的组合框,但碰巧 10.4 和以前的版本绘制了一些看起来还不错的东西。10.5 中的艺术没有分解以支持该绘图的方式。为避免破坏现有应用程序,10.5 中的 NSComboBox 将使用 10.4 的艺术来制作大型组合框,但它不会与系统的其余部分完全匹配。应修改此应用程序以停止使用大型组合框框。此警告将在每次应用启动时出现一次。”

有什么想法该怎么做吗?

我在 IB 中制作了这个盒子,我认为我没有做任何特别的事情来创建它。

0 投票
2 回答
2216 浏览

macos - How to autocomplete values on NSComboBox

I'm developing an app for MacOS X in Xcode5

I want to autocomplete option typed on textfield when user types or deletes text, for instance if user types "Me" then Mexico option is displayed on list of options, so far this is my code:

I already set delegate and datasource of _myCombo and also of its NSComboBoxCell on my NSObjectController but nothing happens, what's the proper code for showing my autocompletion