FROM : Kam Dahlin
DATE : Sat Jun 24 01:15:16 2006
Hey George,
So here is the answer on the NSOpenPanel and my having to add changes
programatically to my NSArrayController.
Chris Hanson's blog has the answer:
http://chanson.livejournal.com/tag/patterns#entry_85659
I guess that NSMutableArray doesn't broadcast KVO messages and so in
order to make it work, you have to use a
[[self mutableArrayValueForKey:@"myMutableArray"] addObject:myObject];
I updated my app to use these calls, and bingo, after I selected my
source in my NSOpenPanel and hit OK, everything populated without
having to make any extra calls to the NSArrayControllers.
Hope this helps, and thanks for you help.
Regards,
k
"Standing before you, to stand behind you, to tell you something I
know nothing about."
On Jun 23, 2006, at 2:58 PM, Kamrin Dahlin wrote:
> Hey George,
>
> Just wanted to tell you that I finally got this working.
>
> I created a File class to represent the individual files of the
> directories I am interested in, and then created another
> NSArrayController to manage those. I followed the MailDemo again,
> exluding the NSObjectController and this time it all worked as
> expected.
>
> The only thing I still don't understand is why I have to
> programmatically add my DirectoryModel objects to my first
> NSArrayController. After I select the directory I am interested in
> and hit OK on the NSOpenPanel, I have to run through a loop that
> creates my DirectoryModel objects and then makes the
> [arrayController addObject:dirModel] call. I am sure there must be
> away to do this with bindings, but I haven't found it yet. I was
> hoping that by simply creating my DirectoryModel objects that KVO
> would handle adding their values to the first NSTableView through
> the first NSArrayController, but maybe it doesn't work that way.
>
> Again, thx for the help -- nice to know that us newbies out here
> have people willing to lend a experienced hand.
>
> Regards,
>
> kam
>
>
> -----Original Message-----
> From: George Orthwein [mailto:george.<email_removed>]
> Sent: Fri 6/23/2006 11:47 AM
> To: Kamrin Dahlin
> Cc: <email_removed>
> Subject: Re: Help with NSArrayController, NSTableView and NSOpenPanel
>
> You can achieve what you want by following the MailDemo example...
> instead of Mailboxes and Emails, you have directoryModels and
> directoryContents, so create another NSArrayController to manage the
> directoryContents array (set it up like the Emails controller).
> http://cocoadevcentral.com/downloads/MailDemo-000084-end.zip
> http://cocoadevcentral.com/articles/000084.php
>
> But now I'm confused as you about your original question. Take the
> MailDemo example... I played around with it and I can't figure out
> why this binding for a table column doesn't work:
> Mailboxes->selection->emails.properties.address
>
> When this line in the controller gets the array fine:
> NSLog(@"log: %@",[mailBoxController
> valueForKeyPath:@"selection.emails.properties.address"]);
>
> Apparently, "mailboxes.selection.emails" is KVO compliant, but
> "mailboxes.selection.emails.properties" is not.
>
> I don't know enough to explain exactly why. Maybe someone can clear
> this up and we'll both learn something. :)
>
> George
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Sat Jun 24 01:15:16 2006
Hey George,
So here is the answer on the NSOpenPanel and my having to add changes
programatically to my NSArrayController.
Chris Hanson's blog has the answer:
http://chanson.livejournal.com/tag/patterns#entry_85659
I guess that NSMutableArray doesn't broadcast KVO messages and so in
order to make it work, you have to use a
[[self mutableArrayValueForKey:@"myMutableArray"] addObject:myObject];
I updated my app to use these calls, and bingo, after I selected my
source in my NSOpenPanel and hit OK, everything populated without
having to make any extra calls to the NSArrayControllers.
Hope this helps, and thanks for you help.
Regards,
k
"Standing before you, to stand behind you, to tell you something I
know nothing about."
On Jun 23, 2006, at 2:58 PM, Kamrin Dahlin wrote:
> Hey George,
>
> Just wanted to tell you that I finally got this working.
>
> I created a File class to represent the individual files of the
> directories I am interested in, and then created another
> NSArrayController to manage those. I followed the MailDemo again,
> exluding the NSObjectController and this time it all worked as
> expected.
>
> The only thing I still don't understand is why I have to
> programmatically add my DirectoryModel objects to my first
> NSArrayController. After I select the directory I am interested in
> and hit OK on the NSOpenPanel, I have to run through a loop that
> creates my DirectoryModel objects and then makes the
> [arrayController addObject:dirModel] call. I am sure there must be
> away to do this with bindings, but I haven't found it yet. I was
> hoping that by simply creating my DirectoryModel objects that KVO
> would handle adding their values to the first NSTableView through
> the first NSArrayController, but maybe it doesn't work that way.
>
> Again, thx for the help -- nice to know that us newbies out here
> have people willing to lend a experienced hand.
>
> Regards,
>
> kam
>
>
> -----Original Message-----
> From: George Orthwein [mailto:george.<email_removed>]
> Sent: Fri 6/23/2006 11:47 AM
> To: Kamrin Dahlin
> Cc: <email_removed>
> Subject: Re: Help with NSArrayController, NSTableView and NSOpenPanel
>
> You can achieve what you want by following the MailDemo example...
> instead of Mailboxes and Emails, you have directoryModels and
> directoryContents, so create another NSArrayController to manage the
> directoryContents array (set it up like the Emails controller).
> http://cocoadevcentral.com/downloads/MailDemo-000084-end.zip
> http://cocoadevcentral.com/articles/000084.php
>
> But now I'm confused as you about your original question. Take the
> MailDemo example... I played around with it and I can't figure out
> why this binding for a table column doesn't work:
> Mailboxes->selection->emails.properties.address
>
> When this line in the controller gets the array fine:
> NSLog(@"log: %@",[mailBoxController
> valueForKeyPath:@"selection.emails.properties.address"]);
>
> Apparently, "mailboxes.selection.emails" is KVO compliant, but
> "mailboxes.selection.emails.properties" is not.
>
> I don't know enough to explain exactly why. Maybe someone can clear
> this up and we'll both learn something. :)
>
> George
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Kam Dahlin | Jun 22, 22:43 | |
| George Orthwein | Jun 23, 04:31 | |
| Kamrin Dahlin | Jun 23, 04:50 | |
| George Orthwein | Jun 23, 15:45 | |
| Kamrin Dahlin | Jun 23, 17:33 | |
| George Orthwein | Jun 23, 20:47 | |
| Kamrin Dahlin | Jun 23, 20:51 | |
| Kamrin Dahlin | Jun 23, 23:58 | |
| Kam Dahlin | Jun 24, 01:15 | |
| Scott Anguish | Jun 24, 08:20 |






Cocoa mail archive

