nscombobox

What are the correct bindings for an NSComboBox for use with Core Data

谁说胖子不能爱 提交于 2020-01-13 19:25:05
问题 Imagine if you will a Core Data app with two entities (Employee, and Department). Employees have a to-one relationship with department (department) and the inverse is a to-many relationship (employees). In the UI you can select individual Employee entities and edit the details in a detail area (there are of course other attributes and there is UI for adding and editing Department entities). When using a popup button the bindings are: content = PopUpArrayController.arrangedObjects content

comboBoxSelectionDidChange gives me previously selected value

ⅰ亾dé卋堺 提交于 2019-12-22 08:37:36
问题 I am using this notification for NSComboBox. Only problem is when I select a different item in the dropdown it always show previously selected value in the combo box. How can I get the currently selected value. I need to make some controls enable/disable based on the value. - (void)comboBoxSelectionDidChange:(NSNotification *)notification { NSComboBox *comboBox = (NSComboBox *)[notification object]; NSLog(@"[comboBox stringValue] : %@", [salaryBy stringValue] ); } 回答1: I got the selected

How to programmatically open an NSComboBox's list?

断了今生、忘了曾经 提交于 2019-12-22 04:38:13
问题 I've been around this for a while.. I thought this should be an easy task, but it isn't =D What I am trying to do, is to display the combobox's list when the user clicks the combobox but not specifically in the button. Any Idea? Thanks in advance! 回答1: This answer fits the title of the question, but not question itself. Omer wanted to touch a text field and have the box popup. This solution shows the popup when the user enters text. I found this answer on cocoabuilder from Jens Alfke. I

Make NSComboBox Appear when NSTextField is clicked

末鹿安然 提交于 2019-12-12 01:06:02
问题 How can I make an NSComboBox disappear when an NSTextField is clicked? This is the code I'm using: Class comboBox: (used as custom class for my NSComboBox in the interface builder) comboBox.h: #import <Cocoa/Cocoa.h> @interface comboBox1 : NSComboBox -(void)Hide; @end comboBox.m: #import "comboBox1.h" @implementation comboBox1 -(void)Hide { [self setHidden:YES]; } @end Class txtField: (used as custom class for my NSTextField in the interface builder) txtField.h: #import <Cocoa/Cocoa.h>

How can I get a populated combobox to display its options in Swift?

一笑奈何 提交于 2019-12-05 02:38:29
问题 With this code I'm able to populate the items in an NSComboBox , but the combobox itself is always empty when you expand it in the app. The number of items being logged is accurate. I know this is rather basic, but I've read and re-read the docs at developer.apple.com and have looked for examples of comboboxes in Swift to no avail, which is quite surprising to me. @IBOutlet var someComboBox: NSComboBox! override func viewDidLoad() { super.viewDidLoad() someComboBox = NSComboBox() someComboBox

NSPopUpButton, NSComboBox similar menu

耗尽温柔 提交于 2019-12-04 06:26:01
问题 I'm trying to create a menu with a drop down menu with a custom background for every cell. First i tried to adapt NSPopUpButton but i couldn't find a way to change the cells background image. Using setImage: would slide the text to the right of the background. Next I stopped at NSComboBox but i couldn't find a way to change the arrow button. Can someone please help with and idea? Next thing would be to create a custom controller but i would like to use something already done. 回答1: To

How can I get a populated combobox to display its options in Swift?

非 Y 不嫁゛ 提交于 2019-12-03 20:13:50
With this code I'm able to populate the items in an NSComboBox , but the combobox itself is always empty when you expand it in the app. The number of items being logged is accurate. I know this is rather basic, but I've read and re-read the docs at developer.apple.com and have looked for examples of comboboxes in Swift to no avail, which is quite surprising to me. @IBOutlet var someComboBox: NSComboBox! override func viewDidLoad() { super.viewDidLoad() someComboBox = NSComboBox() someComboBox.addItemWithObjectValue("Foo") someComboBox.addItemWithObjectValue("Bar") someComboBox

NSPopUpButton, NSComboBox similar menu

Deadly 提交于 2019-12-02 10:13:29
I'm trying to create a menu with a drop down menu with a custom background for every cell. First i tried to adapt NSPopUpButton but i couldn't find a way to change the cells background image. Using setImage: would slide the text to the right of the background. Next I stopped at NSComboBox but i couldn't find a way to change the arrow button. Can someone please help with and idea? Next thing would be to create a custom controller but i would like to use something already done. To customise the arrow button in NSComboBox, you need to create a subclass of NSComboBoxCell and set your combo box to

Any example about custom NSComboBox?

微笑、不失礼 提交于 2019-11-28 04:43:01
问题 I am asked to implement an combo box like this: It is clear that this is quite different from NSComboBox : <1> The button of beside the text field should be customized <2> This is much more important: there is an additional "cross" (which is a button indicating "delete" action) in each of the combo item. How can I achieve this effect? I searched for the internet but fount no answer. Could any one tell me what I should make this or tell me any example of subclassing or customizing NSComboBox