Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[BINDINGS] NSTableView vs. NSUserDefaultsController

 
   Mac (Home) -> General Discussion RSS
Next:  Using CLI to register an application to handle UR..  
Author Message
Des Courtney

External


Since: May 22, 2005
Posts: 1



(Msg. 1) Posted: Sun May 22, 2005 1:04 pm
Post subject: [BINDINGS] NSTableView vs. NSUserDefaultsController
Archived from groups: comp>lang>objective-c, others (more info?)

I've already posted the following message to Apple's cocoa-dev
mailing list, so if you subscribe to that list or are a regular
reader of CocoaBuilder.com, you've already seen this. I'm posting
here since I've appeared to have violated list etiquette and my
messages seem to be ignored...

Currently, I am working on a prefs dialog for an experimental
Cocoa app. (The same one I found the NSMovie memory leak on,
FYI.) So far, I made a pref window that mixes both
NSUserDefaultsController/Bindings controls with a NSTableView
that is using a data source, delegation, and an outlet
connection to do its work, calling NSUserDefaults directly.
The problem is that the above three objects are one and the same...
a royal mix-up from a MVC perspective. I'm trying to re-work
the table view control to use the NSController and Cocoa bindings
to make the entire dialog consistent.

The gist of what I'm trying to do: I'm populating the table view
with a set of rows that contains several user visible columns
and a hidden "column" that acts as a row ID for storage in the
prefs file. I've made an example app of what I've made so far
while trying to figure out a pure-bindings way of doing things...

<http://users.ameritech.net/wormwood/BoundTable.zip>

This is what I've been able to accomplish, based on reading the
mailing list archives, the bindings documentation, and examining
what few bindings code examples I could find on the 'Net.
(The best resource I've found, the mmalc Cocoa examples, includes
every binding trick EXCEPT the very thing I'm trying to do,
it seems like.)

- I've bound the table view to a NSArrayController. This allowed
me to remove the data source, but I still needed some code to
populate the contents of this controller. (My original data
source was returning results dynamically, instead of from an
array.)

- Each array entry is a dictionary with several keys, in my example,
"colOne" is the value to display in the table view, "colTwo" is
the value to store in the prefs file.

- I'm able to bind an NSObjectController to "values.storedValue"
specifically, so I can display it's contents in an text field.
To stuff a test value to display, you can type...

defaults write com.mac.wormwood.boundTable storedValue "Hidden pref #25"

....in the Terminal if you don't want the bottom field of the
example app I provided to be blank.

- I've also bound another NSObjectController to "selection.colTwo"
of the array controller. I'm able to confirm (via a bind to a
second text field) that this value is updated whenever I change
the selection of the table view. This allowed me to remove the
delegate aspect of my "working" design.

Where I'm falling down at is how to link the "selection.colTwo"
and "values.storedValue" objects together so that the table views
row ID is stored in the prefs file. I've tried connects, changing
the bindings, and even manually copy/pasting the values between the
two text fields (after making them editable) to figure out a way.

If my above explanation is still too vague, I can provide my "working"
example. But, I think what I've provided may already be more than
what most list readers are willing to put up with.

Des
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Any tame MAC users out there ? - Hi all, could anyone tell me why the HTML generated from an XSL/XML merge would not display on an apple Mac. http://www.bedfords.co.uk/pages/search/search.asp (and just click "search") The page works fine on IE5,IE6, Mozilla and Firefox. Th...

[ANN] ADHOC/MacHack sessions announcement & the Transition.. - Apple is moving to Intel -- Don't Panic! Come to ADHOC and learn what developers need to do. Held in Dearborn, Michigan from July 27th through 31st (a little over a month after WWDC), ADHOC has always been focused on giving developers the edge when i...

Use of stty - Has anyone here used stty to set the baud rate of a serial port in a script or just from the command line ? I am trying to use "screen <ser port path>" which gives you a serial (VT100) terminal through the selected port. In my case I am...

NSData's +dataWithContentsOfFile - Hi, I'm considering using Cocoa rather than Carbon... How do I init an NSData object with data from a file *but* only from x bytes in with a length of y bytes into the file? I don't want to read the whole file into one data object then copy x bytes..

Question Regarding Key Windows - I am just learning Mac programming (coming over from .NET on Windows & Web), and I was going through "Introduction to Developing Cocoa Objective-C Applications: A Tutorial". In it, Apple says, "Key windows respond to key presses for an...
       Mac (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact