Proper use of representedObject in segues
Hi, I understand that when preparing for segue and sending information to the ViewController of the PopUp, Sheet, etc. I should make use of the representedObject of that ViewController. So far, so good. What, however, if I want to send information back to my parent view? Is the proper way to make use of the representedObject of the presentingViewController? Thanks! /Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Choosing correct ArrayController depending on active TableView
Hi, I have two ArrayControllers in IB, ArrayControllerA and ArrayControllerB, who's content are setup to show in two TableViews, TableViewA and TableViewB. Pressing a button in the interface will perform some actions on the selected objects from TableViewA or TableViewB. I can of course select objects in either of the two TableViews, but the most recent selected TableView is active or focused. My question is: how do I, when pressing the button, get information on which TableView is active, hence which ArrayController's content I should perform actions on? Thanks! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Key Value Observing of NSMutableArray inside an object
Hi, Background: I have put an NSMutableArray (dataObjectArray) in my class DataObjectCollection. I have also made it possible to add objects to DataObjectCollection and hence the array by implementing - (void)addDataObject:(DataObject *)theDataObject { NSIndexSet *loneIndex = [NSIndexSet indexSetWithIndex:[[self dataObjectArray] count]]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:loneIndex forKey:@dataObjectArray]; [dataObjectArray addObject:theDataObject]; [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:loneIndex forKey:@dataObjectArray]; } In InterfaceBuilder I have put an ArrayController with ContentArray bound to myAppDelegate.theDataObjectCollection.dataObjectArray I have created bindings between the ArrayController and the columns of an NSTableView is Problem: Programmatically adding objects to my DataObjectCollection is not observed by the ArrayController. I earlier had the dataObjectArray directly in my AppDelegate and then the key value observing worked. Is there something I need to do with my class DataObjectCollection to make the observing work, i.e. to make it KVO compliant? Thanks! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSPopUpButton, notification when selecting value/object
Hi all, I found in the reference that a notification is sent when a popup button is clicked, NSPopUpButtonWillPopUpNotification. That's good, but how about when I've selected an object or value in the popup list and released the mouse button? How can I make my application aware of that? Regards /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Selection of object in popup button
Hi Alejandro, Thanks for your reply. Can you explain further what you mean with binding the appearance attributes of your cell? /Mikael 26 sep 2010 kl. 22.35 skrev Alejandro Rodríguez: Hey Mikael, In order to solve your issues you need to get away from selection. Providing the data available in your popups is a Model matter not a View/Controller issue so it should not depend on the current table selection. The easiest way to do this is using bindings. If you have an Array Controller providing content for your table then you can set the keypath in your column to your model method that returns the desired array for a given object. As for updating the cells you need to tell the table that it needs to redraw itself. However if you bind the appearance attributes of your cell the model object you can also achieve the same result without any code. the arrayController.arrangedObjects keypath is your friend here. Good luck, Alejandro Dear developers, In a table view I have in one column a popup button cell. The content array of the popup button depends on what object is selected in the table view and also a predicate object. I have noticed some problems when coding this, though: 1. If no row (object) is selected in the table view, clicking on the popup button for one row reveals the array of the popup button, but the content array depends on the selected object in the table view. But it seems like no object is selected. The second time i click the popup button the row is recognized as selected. How do I overcome this? 2. Depending on what object I select in the popup button some attributes of the selected object in the table view is affected. It seems, though, like selecting an object in the popup button is not enough. I need to deselect the row in the table view or select another row to actually perform the selection. How do I overcome this? Thanks! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40wamundson.eu This email sent to co...@wamundson.eu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Selection of object in popup button
Dear developers, In a table view I have in one column a popup button cell. The content array of the popup button depends on what object is selected in the table view and also a predicate object. I have noticed some problems when coding this, though: 1. If no row (object) is selected in the table view, clicking on the popup button for one row reveals the array of the popup button, but the content array depends on the selected object in the table view. But it seems like no object is selected. The second time i click the popup button the row is recognized as selected. How do I overcome this? 2. Depending on what object I select in the popup button some attributes of the selected object in the table view is affected. It seems, though, like selecting an object in the popup button is not enough. I need to deselect the row in the table view or select another row to actually perform the selection. How do I overcome this? Thanks! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Value Transformer with multiple Model Key Paths
Hi, Problem is the following: I want to set the color of the text in each line in a TableView depending on two attributes of the object: one boolean and one integer. If the boolean is true all text for that line in the TableView is to be colored blue, if the integer is zero all text is to be colored red. In IB i've bound the TableColumns Text Color using the boolean as Model Key Path and a Value Transformer setting the text color to blue. Now, how do I setup a Value Transformer bound to the integer attribute and a Value Transformer? Thank you! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Value Transformer with multiple Model Key Paths
Yes, this is my implementation: @implementation TextColorValueTransformer + (Class)transformedValueClass { return [NSColor class]; } + (BOOL)allowsReverseTransformation { return NO; } - (id)transformedValue:(id)value { BOOL theBoolean = [value boolValue]; if (theBoolean) { return [NSColor blueColor]; } return [NSColor blackColor]; } @end 30 maj 2010 kl. 23.13 skrev Reinhard Segeler: Did you subclass the NSValueTransformer class for that purpose? -- Reinhard Am 30.05.2010 um 21:51 schrieb Mikael Wämundson: Hi, Problem is the following: I want to set the color of the text in each line in a TableView depending on two attributes of the object: one boolean and one integer. If the boolean is true all text for that line in the TableView is to be colored blue, if the integer is zero all text is to be colored red. In IB i've bound the TableColumns Text Color using the boolean as Model Key Path and a Value Transformer setting the text color to blue. Now, how do I setup a Value Transformer bound to the integer attribute and a Value Transformer? Thank you! /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/macmeideln%40googlemail.com This email sent to macmeid...@googlemail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Standard input/output in Objective-C
First: Yes, I've been looking around on the net to find an answer ;) I really like the C++ method of using cin/cout in the iostream.h when communicating via the standard input/output (i.e. the Terminal). When doing this in Objective-C it gets, to me, very complicated. Seems I'm going wrong some way. My first attempt is of course to just use the cin/cout methods by importing iostream.h, but when looking for the header file I find it deeply buried (/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/stream) and I don't succeed in importing it. My conclusion from this is: I'm not supposed to use cin/cout in an Objective-C application??? Second attempt is to use Objective-C methods like: NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardInput]; NSData *inputData; NSString *inputString; Person *aPerson = [[Person alloc] init]; printf(Type the persons first name: ); inputData = [fileHandle availableData]; inputString = [[NSString alloc] initWithData: inputData encoding:NSUTF8StringEncoding]; [aPerson setPersonsFirstName: inputString]; Feels complicated. My conclusion: I'm making it more complicated than it should be??? Happy for feedback! /Mikael___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Standard input/output in Objective-C
Thnx! Just changing the suffix to .mm and rebuilding worked and the library was found! Great! /Mikael 23 mar 2010 kl. 22.56 skrev Brian Postow: On Mar 23, 2010, at 5:44 PM, Mikael Wämundson wrote: First: Yes, I've been looking around on the net to find an answer ;) I really like the C++ method of using cin/cout in the iostream.h when communicating via the standard input/output (i.e. the Terminal). When doing this in Objective-C it gets, to me, very complicated. Seems I'm going wrong some way. My first attempt is of course to just use the cin/cout methods by importing iostream.h, but when looking for the header file I find it deeply buried (/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/stream) and I don't succeed in importing it. My conclusion from this is: I'm not supposed to use cin/cout in an Objective-C application??? Did you try using an objective-C++ program? in Xcode, if you make all of your .m files into .mm files, it should automatically compile as objective-c++ and then cin and cout may work... Also, you shouldn't need to do more than #include streamio.h like normal... the compiler should know where to find it. Brian Postow Senior Software Engineer Acordex Imaging Systems ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
indexOfObjectIdenticalTo: problem with NSArrayController
Hi all. Since it is good programming to not access an array's content through its controller when in the model I'm trying to find a way to get to the same object selected in the user interface (i.e. the array controller). In my view I have the array content sorted by binding it to a sort descriptor. Thus, the indices of the array and the content of the array shown in the view differs. Now, when a certain object is selected in the view I want to do something to this object by accessing it through the original array. My first, perhaps foolish, guess would be to use indexOfObjectIdenticalTo: or indexOfObject: like this: int indexOfObject = [theOriginalArray indexOfObjectIdenticalTo: [theArrayController selection]]; but this does not work. Looking in the reference I see that [theArrayController selection] will return a proxy object. Is this the reason my code won't work? How would you solve this? /wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problem with binding of @count
I have some problem binding the number of objects in an array to a text label in app. Just binding the label to my array controller (Controller Key = arrangedObjects and Model Key Path = @count) works fine and the value is updated when a change is made to the array. But I want the number of objects to be part of a text string (The number of students is: the value). Thus I put this code into myDocument.m: -(NSString *) numberOfStudents { return [NSString stringWithFormat:@The number of students is: %@, [theStudentArrayController valueForKeyPath:@[EMAIL PROTECTED]]]; } No error during compilation or run-time, but value in the text label is not updated when the array is changed. Any clues? /wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problem archiving/unarchiving object graph containing NSMutableArray
Hi experienced developers! I'm trying to archive/unarchive an object graph using archivedDataWithRootObject: aRootObject. aRootObject has two instance variables of type NSMutableArray. Each mutable array contains customs objects of different types (subclasses of NSObject). For aRootObject and the custom objects in the mutable arrays I have implemeted encodeWithCoder and initWithCoder. When archiving encodeWithCoder gets called for the root object but not for the custom objects in the arrays. Same when unarchiving. Am I missing something? /wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Configure a button added in IB
Thanks! Works like a charm. Didn't work at first because I put theButton = [[NSButton alloc] init]; before the [theButton setTitle:@send steve money]; When that was removed, it worked ok (and you will probably get your money). wamund 16 nov 2008 kl. 02.48 skrev Steven Riggs: To do it from code, add something like.. IBOutlet NSButton *theButton; ...to your .h Instanitate your class in interface builder and then connect theButton to your button my control dragging from your class to the button. and then use the documentation here: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSButton_Class/Reference/Reference.html ...to learn what kind of messages you can send to it. ex. [theButton setTitle:@send steve money]; :-) Good luck, Steven Riggs On Nov 15, 2008, at 7:04 PM, Mikael Wämundson wrote: Am a quite a newbie to Cocoa programming. Adding and configuring a button in IB is straightforward. I understand the process of setting action and target in IB and the connection to Xcode (IBOutlet and IBAction). But what is the approach when creating a button in IB that I then want to configure (set title, image, enabled, etc.) in Xcode? How do I reach the button from Xcode? wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/steven.riggs %40me.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Using NSDateFormatter on NSPopUpButton in IB
Hi all experienced developers! It is possible to apply a NSDateFormatter on a NSPopUpButton in IB, but whatever settings I do with the formatter I can't get it to format the date. The PopUpButton is connected to an ArrayController using binding. The array contains objects with a NSCalendarDate variable. This variable is used in the binding. Any suggestions? /wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Configure a button added in IB
Am a quite a newbie to Cocoa programming. Adding and configuring a button in IB is straightforward. I understand the process of setting action and target in IB and the connection to Xcode (IBOutlet and IBAction). But what is the approach when creating a button in IB that I then want to configure (set title, image, enabled, etc.) in Xcode? How do I reach the button from Xcode? wamund ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]