Beginner needs help with a table

Hello, Im creating a table view scroll view thingy. And when I go to run my program, I am getting this error. “Can’t get every data row of null. (-1728)”

Im going to past my code, I hope someone can help me. Im sure its obvious, Im just a rookie at this.

property theDataSource : null
on clicked theObject
	set theItem to make new data row at end of every data row of theDataSource
	getContactInfo(window of theObject, theRow)
	set myData to {{"item1", "item2", "item3", "item4", "item5", "item6", "item7"}, {"empty"}}
end clicked
on will open theObject
	set theDataSource to data source of table view "Data" of scroll view "DataBox" of window of theObject
	tell theDataSource
		make new data column at the end of the data columns with properties {name:"Name"}
		make new data column at the end of the data columns with properties {name:"Page"}
		make new data column at the end of the data columns with properties {name:"Bounds"}
		make new data column at the end of the data columns with properties {name:"Scale"}
		make new data column at the end of the data columns with properties {name:"Horizontal Scale"}
		make new data column at the end of the data columns with properties {name:"Vertical Scale"}
		make new data column at the end of the data columns with properties {name:"File Path"}
	end tell
end will open
on getContactInfo(theWindow, theRow)
	tell theWindow
		set contents of data cell "Name" of theRow to item 2 of item 1 of myData
		set contents of data cell "Page" of theRow to item 3 of item 1 of myData
		set contents of data cell "Bounds" of theRow to item 7 of item 1 of myData
		set contents of data cell "Scale" of theRow to item 6 of item 1 of myData
		set contents of data cell "Horizontal Scale" of theRow to item 4 of item 1 of myData
		set contents of data cell "Vertical Scale" of theRow to item 5 of item 1 of myData
		set contents of data cell "File Path" of theRow to item 1 of item 1 of myData
	end tell
end getContactInfo
on clearData()
	set theTableView to table view "Data" of scroll view "DataBox" of window "theWindow"
	set theDataSource to data source of theTableView
	delete every data row of theDataSource
	set data source of theTableView to theDataSource
end clearData

Model: Mac G4
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041217
Operating System: Mac OS X (10.3.8)

Two questions:

  1. What is the object that is attached to the “on will open” handler? The reference in the first line of the handler, “set theDataSource to data source.”, seems like a potential problem (without knowing how things are associated to each other and what is attached to the handler).

  2. Did you connect a data source object to the table view in IB?

I also noticed in the above “clicked” handler that you set “theItem” to make a new data row but in “getContactInfo” you use “theRow” instead of “theItem.”

Brad Bumgarner, CTA

The problem is probably

set theItem to make new data row at end of every data row of theDataSource

(I searched for the word “every” in the source text, since that is what the error message said, although Xcode should highlight the problematic line)

I think it should be :

set theItem to make new data row at end of data rows of theDataSource