I have yet to get a table view to work properly. I’m trying to create a table view that contains data from the address book. The following code works in so much as it causes no errors, but when it’s done, none of the data is in the table.
property addressbookData : {}
on awake from nib theObject
if name of theObject is "nameTblVw" then createNameDatasource(theObject)
end awake from nib
on createNameDatasource(theObject)
tell application "Address Book"
set addressbookData to properties of every person
end tell
say "got data"
-- Create the data source; this places it in the application
-- object's data source elements. (Assign it to table view below.)
set theDataSource to make new data source at end of data sources with properties {name:"names"}
say "created data source"
-- Create each of the data columns, including the sort information
-- for each column
make new data column at end of data columns of theDataSource with properties {name:"name", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
say "created column"
-- Make this a sorted data source
set sorted of theDataSource to true
say "set sorted"
-- Set the "name" data column as the sort column
set sort column of theDataSource to data column "name" of theDataSource
say "set name sort"
-- Set the data source of the table view to the new data source
set data source of theObject to theDataSource
say "set data source"
-- Add the table data (using the new "append" command)
append theDataSource with addressbookData
say "appended source"
end createNameDatasource
(I put the say lines in to let me know that the entire handler was being executed).
The nib file has a table view named “nameTblVw” inside a scroll view named “nameScrlVw” and containing a column called “name”. By everything I know, this should work.
I need a second pair of eyes to tell me what (probably obvious) point I’m missing.