Re: Storing a table view in user defaults

2009-04-29 Thread Ryan Briones
On Tue, Apr 28, 2009 at 2:31 PM, Jerry Krinock je...@ieee.org wrote:


 On 2009 Apr 28, at 08:04, Ryan Briones wrote:

  My problem is that I have a table view that's bound
 to an array controller backed by user defaults in IB.


 I don't know what backed by means.


Sorry for not using the proper terminology. I have a table view whose
columns are bound to an array controller (Controller Key: arrangedObjects,
Model Key Path: name, etc) and the array controller is bound to shared user
defaults (Controller key: values, Model Key Path: arrayOfThings). Also I
have a button that send add: to the array controller and a button that sends
delete: and Enabled is bound to canRemove: on the array controller. Seems
like pretty standard setup from what I can tell.

When I click add, I get an empty row (selected) in the table view. I can
then double click on the row and edit the columns. If I click add again, the
first row is emptied out and the second row is selected and empty. If I exit
the application at this point and relaunch, the table view has 2 empty rows.

I hope this helps explain my problem better...Sorry for the confusion.


 The 'content' binding of your array controller should be bound to an
 NSUserDefaults object (labelled Shared Defaults by Interface Builder) with

   Controller Key = 'values'
   Model Key Path = keyToYourArrayInRootOfUserDefaults.

 ___

 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/ryan.briones%40brionesandco.com

 This email sent to ryan.brio...@brionesandco.com




-- 
Ryan Carmelo Briones
___

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: Storing a table view in user defaults

2009-04-29 Thread Ryan Briones
Hey, thanks! I actually ran across your code last night when I was first
doing this. I ran your code and it worked fine. I created a test project to
copy your code, and mine failed. I tried looking at every checkbox and
every key path, nothing worked.
I've uploaded my the test project to github. I'd love it if you guys could
take a look, and tell me what I'm doing wrong. I feel like it's an exact
copy, but it doesn't work. Hopefully this can provide an insight into my
stupidity.

http://github.com/ryanbriones/tableview-userdefaults

If you don't have git, you can download a zip or tarball from the downloads
tab. Thanks!

On Tue, Apr 28, 2009 at 5:00 PM, Steven Riggs steven.ri...@me.com wrote:

 Check out the sample code here that demonstrates storing a dictionary in
 defaults with no code.
 http://idisk.mac.com/steven.riggs-Public?view=web

 I hope it helps...

 Steven Riggs



 On Apr 28, 2009, at 11:04 AM, Ryan Briones wrote:

  I'm a relative newb when it comes to cocoa programming, but I've been
 trying
 to finish of a project and put it out there so I can get some feedback and
 continue to get better. My problem is that I have a table view that's
 bound
 to an array controller backed by user defaults in IB. Adding a single new
 row works fine, but if I add any more, the data from the previous rows
 gets
 wiped out, but the actual rows get preserved. Further more, if I create a
 row and exit/relaunch the rows are persisted, but the data is not. If feel
 like I'm missing some important detail, but I can't figure out what. Any
 help is appreciated. Thanks.

 --
 Ryan Carmelo Briones
 ___

 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 steven.ri...@me.com





-- 
Ryan Carmelo Briones
___

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


Storing a table view in user defaults

2009-04-28 Thread Ryan Briones
I'm a relative newb when it comes to cocoa programming, but I've been trying
to finish of a project and put it out there so I can get some feedback and
continue to get better. My problem is that I have a table view that's bound
to an array controller backed by user defaults in IB. Adding a single new
row works fine, but if I add any more, the data from the previous rows gets
wiped out, but the actual rows get preserved. Further more, if I create a
row and exit/relaunch the rows are persisted, but the data is not. If feel
like I'm missing some important detail, but I can't figure out what. Any
help is appreciated. Thanks.

-- 
Ryan Carmelo Briones
___

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: Storing a table view in user defaults

2009-04-28 Thread Jerry Krinock


On 2009 Apr 28, at 08:04, Ryan Briones wrote:


My problem is that I have a table view that's bound
to an array controller backed by user defaults in IB.


I don't know what backed by means.  The 'content' binding of your  
array controller should be bound to an NSUserDefaults object (labelled  
Shared Defaults by Interface Builder) with


   Controller Key = 'values'
   Model Key Path = keyToYourArrayInRootOfUserDefaults.

___

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: Storing a table view in user defaults

2009-04-28 Thread Jerry Krinock


On 2009 Apr 28, at 11:41, Ryan Briones wrote:

Sorry for not using the proper terminology. I have a table view  
whose columns are bound to an array controller (Controller Key:  
arrangedObjects, Model Key Path: name, etc) and the array controller  
is bound


You didn't say which binding.  Should be the 'value' binding.

to shared user defaults (Controller key: values, Model Key Path:  
arrayOfThings). Also I have a button that send add: to the array  
controller and a button that sends delete: and Enabled is bound to  
canRemove: on the array controller. Seems like pretty standard setup  
from what I can tell.


Yes, it is.  Sorry to be picking nits but what you've described is  
very similar to what I have done.  The answer is going to be in a nit.


Add an item to your table, then gracefully quit your application.   
Open the file ~/Library/Preferences/com.myCompany.MyApp.plist with a  
plist editor and look at arrayOfThings.


___

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: Storing a table view in user defaults

2009-04-28 Thread Steven Riggs
Check out the sample code here that demonstrates storing a dictionary  
in defaults with no code.

http://idisk.mac.com/steven.riggs-Public?view=web

I hope it helps...

Steven Riggs


On Apr 28, 2009, at 11:04 AM, Ryan Briones wrote:

I'm a relative newb when it comes to cocoa programming, but I've  
been trying
to finish of a project and put it out there so I can get some  
feedback and
continue to get better. My problem is that I have a table view  
that's bound
to an array controller backed by user defaults in IB. Adding a  
single new
row works fine, but if I add any more, the data from the previous  
rows gets
wiped out, but the actual rows get preserved. Further more, if I  
create a
row and exit/relaunch the rows are persisted, but the data is not.  
If feel
like I'm missing some important detail, but I can't figure out what.  
Any

help is appreciated. Thanks.

--
Ryan Carmelo Briones
___

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 steven.ri...@me.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


Re: Storing a table view in user defaults

2009-04-28 Thread Steven Riggs
You were right there.  All you have to do to get it to work is check  
'Handles content as compound value' on the array controller content  
array binding.


All the best,
   Steven Riggs


On Apr 28, 2009, at 10:02 PM, Ryan Briones wrote:

Hey, thanks! I actually ran across your code last night when I was  
first doing this. I ran your code and it worked fine. I created a  
test project to copy your code, and mine failed. I tried looking  
at every checkbox and every key path, nothing worked.


I've uploaded my the test project to github. I'd love it if you  
guys could take a look, and tell me what I'm doing wrong. I feel  
like it's an exact copy, but it doesn't work. Hopefully this can  
provide an insight into my stupidity.


http://github.com/ryanbriones/tableview-userdefaults

If you don't have git, you can download a zip or tarball from the  
downloads tab. Thanks!


On Tue, Apr 28, 2009 at 5:00 PM, Steven Riggs steven.ri...@me.com  
wrote:
Check out the sample code here that demonstrates storing a  
dictionary in defaults with no code.

http://idisk.mac.com/steven.riggs-Public?view=web

I hope it helps...

Steven Riggs



On Apr 28, 2009, at 11:04 AM, Ryan Briones wrote:

I'm a relative newb when it comes to cocoa programming, but I've  
been trying
to finish of a project and put it out there so I can get some  
feedback and
continue to get better. My problem is that I have a table view  
that's bound
to an array controller backed by user defaults in IB. Adding a  
single new
row works fine, but if I add any more, the data from the previous  
rows gets
wiped out, but the actual rows get preserved. Further more, if I  
create a
row and exit/relaunch the rows are persisted, but the data is not.  
If feel
like I'm missing some important detail, but I can't figure out what.  
Any

help is appreciated. Thanks.

--
Ryan Carmelo Briones
___

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 steven.ri...@me.com




--
Ryan Carmelo Briones


___

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