cocoa-bindings

Implementing parent->child drill down in Cocoa with Core Data bindings that span multiple entities

随声附和 提交于 2019-12-09 04:17:11
问题 I'm trying to create a simple interface to my core data model in the style of iTunes Genre browser. I have a model setup with three entities: Genre <-->> Artist <-->> Album . I'd like to simply tie them each to a NSTableView, but it appears as though accessing children relationships from a NSArrayController is not KVC compliant. So, I'm having difficulty communicating the selected Genre objects to the ArtistController. How do you do this? Is it even possible within IB without any custom

NSPopUpButton + Bindings + Show All Option

天涯浪子 提交于 2019-12-09 01:05:29
问题 I'm trying to develop a NSPopUpButton that will serve as a filter to some datasource, let's say a NSArrayController that fills a table. I can bind the NSArrayController from the menu to the selection keypath so the data is properly filtered, no problem with that. Tricky part is, I want the content of this NSPopUpButton to rely on an NSArrayController using bindings, but I'd like to add a "Show All" menu item, or at least some item that doesn't come from the Core Data and performs some special

Writing a matrix to a text file

[亡魂溺海] 提交于 2019-12-08 14:09:13
问题 So i have done how to read a matrix from a text file where the first line defines the elements, however my question is how would i do the opposite that would write to the text file. I would like it to ask the user for the row 0 column 0, and add on, and have this code to write into the console, but do not know how to do into a text file This is the code to write into console: Dim size As Integer = 3 Dim numberWidth As Integer = 2 Dim format As String = "D" & numberWidth Dim A(size - 1, size -

Programmatically update a TableView that is governed by Cocoa Bindings

北战南征 提交于 2019-12-08 07:37:50
问题 I'm fairly new to obj-c and cocoa so please bear with me: I have a NSTableView set up with cocoa bindings which works as expected with the simple -add -remove, etc methods provided by an instance of NSArrayController in my nib. I would like to programmatically add objects to the array that provides content for this controller (and hence for the table view) and then update the view accordingly. I current have a working method for adding a new object to the array (verified by NSLog) but I can't

Programmatically update a TableView that is governed by Cocoa Bindings

萝らか妹 提交于 2019-12-08 07:06:31
I'm fairly new to obj-c and cocoa so please bear with me: I have a NSTableView set up with cocoa bindings which works as expected with the simple -add -remove, etc methods provided by an instance of NSArrayController in my nib. I would like to programmatically add objects to the array that provides content for this controller (and hence for the table view) and then update the view accordingly. I current have a working method for adding a new object to the array (verified by NSLog) but I can't figure out how to update the table view. So: How do I update the bound tableview? (ie, after I have

How to add an object to a programatically bound NSMutableArray?

ⅰ亾dé卋堺 提交于 2019-12-08 04:15:54
问题 I have an NSDocument which has the following structure: @interface MyDocument : NSDocument { NSMutableArray *myArray; IBOutlet NSArrayController *myArrayController; IBOutlet MyView *myView; } @end I instantiate the NSArrayController and the MyView in MyDocument.xib, and have made the connections to the File's Owner (MyDocument), so I am pretty sure that from the point of view of Interface Builder, I have done everything correctly. The interface for MyView is simple: @interface MyView : NSView

Cocoa bindings problem; bound table columns don't show any data, no errors in console

别等时光非礼了梦想. 提交于 2019-12-08 02:32:17
问题 I'm having trouble converting my Cocoa project from a manually-synched interface model to a bindings model so that I don't have to worry about interface glue code. I followed the CocoaDevCentral Cocoa Bindings tutorial to make sure that I had covered all the bases, but things aren't working correctly. I have a master-detail interface, but I'm having trouble even getting the master portion of the interface to work correctly. No data is showing up in the master column, even though I've set up

How to create a binding for NSApp.dockTile's

社会主义新天地 提交于 2019-12-08 01:35:55
问题 In IB it is easy to bind a label or text field to some controller's keyPath. The NSDockTile (available via [[NSApp dockTile] setBadgeLabel:@"123"]) doesn't appear in IB, and I cannot figure out how to programmatically bind its "badgeLabel" property like you might bind a label/textfield/table column. Any ideas? 回答1: NSDockTile doesn't have any bindings, so your controller will have to update the dock tile manually. You could do this using KVO which would have the same effect as binding it.

NSButton in NSTableCellView: How to find desired objectValue?

家住魔仙堡 提交于 2019-12-07 10:06:54
问题 I have a view-based NSTableView that is populated through bindings. My textFields & imageViews are bound to the NSTableCellView's objectValue's properties. If I want to have an edit/info button in my NSTableCellView: Who should be the target of the button's action? How would the target get the objectValue that is associated with the cell that the button is in? I'd ultimately like to show a popover/sheet based on the objectValue. 回答1: Your controller class can be the target. To get the object

How do I delete an entity when removing it from an array controller?

强颜欢笑 提交于 2019-12-07 08:35:23
问题 I have an entity (e.g. Employee) in a managed object model that is related to two other entities (e.g. Department and Team). Both relationships are one-to-many (i.e. an Employee must have one Department and one Team, Teams and Departments have many Employees). The two may or may not overlap (e.g. a team might be made up of employees from HR, Accounting & I.T. or it might jut consist of several employees from the one department). Department <-->> Employee <<--> Team I have two