[Biococoa-dev] [OT]: Cocoa Bindings
Koen van der Drift
kvddrift at earthlink.net
Tue Aug 2 19:21:27 EDT 2005
Hi,
Anyone want to help me with using Cocoa Bindings (it's bio-related)?
I've looked at the docs, and examples, and kinda understand the
concept, but the implementation is still not working :(
Here's what I am trying to do. I have a panel from which the user can
load a sequence from a database (NCBI, etc). I created a plist that
contains the URL's for the databases, and the plist is loaded into an
NSDictionary (databases). The keys of the dict hold the names of the
databases, the values the URL's. So far, so good.
The panel has an NSPopupButton that has the keys of the databases as
it's titles, and a NSTextField where the user types in the accession
number. When the user clicks 'Load', the correct URL is constructed
and the sequence is retrieved using NSURLRequest. This also works fine.
The problem I am having is with the bindings that connect the
databases to the titles of the popup. I have added an
NSArrayController ("Databases") to my nib and set the 'contentArray'
to databases.allKeys. For the NSPopupButton I have three bindings:
content = arrangedObjects (Databases)
contentValues = arrangedObjects.titles (Databases)
selectedObject = database (File Owner)
where 'database' is an NSString representing the current selected
database, and FileOwner is the DatabaseWindowController.
The panel loads fine, and the popup shows the value of the current
database. Even fetching a sequence works. So I am really close to get
this thing to work. The only problem I have is, I cannot click the
popup to change the database. Anyone has a clue how I can fix that?
If it is working I have no problems with adding the code to one of
the BioCocoa examples :)
cheers,
- Koen.
More information about the Biococoa-dev
mailing list