How to put list into app window instead of list with prompt

Hello, i am in the process of taking an applescript that i wrote and (for the 1st time :slight_smile: ) porting it to an app thru applescript studio.
Originally, I gerenerated a list and then called:


choose from list theList with prompt "Choose from this List:"

from here the result would run the rest of the script. Simple enough…
But now that i am building it into a standalone app & I want to load the list into a window instead of a pop up list. I am not sure what type of window it needs to be or how to format the data to load it in.
I was able to load it into a text field but it clearly is not what i want.
Anyone willing to help out an applescript studio newbie or point to some good examples of tutorial that do this?
Thanks,
JO

You need a regular window and a table with rows…
Take a look to these and snag all you want!
“/Developer/Examples/AppleScript Studio/Table/”
“/Developer/Examples/AppleScript Studio/Table Sort/”

thanks… I was looking into every one but that one!
Thanks for the direction…
JO :smiley:

Hi,
so I have figured out most of this… i have connected a data source to the table and put in a button to addsome text… but i get an error: applescript error -1708
here is my code… any clue what i am doing wrong?


property DataSource : null


------------------------------------------------EVENT HANDLERS

on clicked theObject
	set theFinalList to "this is a test."
	set theRow to make new data row at the end of the data rows of DataSource
	my getContactInfo(window of theObject, theRow, theFinalList)
end clicked

on will open theObject
	set DataSource to data source of table view "theList" of scroll view "theList" of theObject
	tell DataSource
		make new data column at the end of the data columns with properties {name:"Test"}
	end tell
end will open

------------------------------------------------SUBROUTINES

on getContactInfo(theWindow, theRow, theFinalList)
	tell theWindow
		set contents of data cell "Test" of theRow to theFinalList
	end tell
end getContactInfo

Thanks for any help you can give this newbie!
JO

What happens if you change:

set contents of data cell "Album" of theRow to theFinalList

With:

set contents of data cell 1 of theRow to theFinalList

nope same error…
I see what you were pointing to and that was just an error in the post and not in my code.
I edited the post to reflect my code.
Any more ideas on why i am getting the error?
Also, when you do press the button it doesadd a data row to the field… but there is nothing in the field.
Thanks,
JO

ok… more progress…
I have figured out what the error was caused by… i had forgotten to uncheck awake from nib when i was troubleshooting and removing unnessasary code… :rolleyes:
anyway… i am sucessful in creating a new data row, but i am still unsucessful in adding data to the row. I have tried the code listed above as well as adding a text field ala the table example changing the code to:


------------------------------------------------PROPERTIES

property DataSource : null

------------------------------------------------EVENT HANDLERS

on clicked theObject
	tell window "Window"
		set theRow to make new data row at the end of the data rows of DataSource
		my getContactInfo(window of theObject, theRow)
	end tell
end clicked

on will open theObject
	set DataSource to data source of table view "list" of scroll view "list" of theObject
	tell DataSource
		make new data column at the end of the data columns with properties {name:"test"}
	end tell
end will open

------------------------------------------------SUBROUTINES

on getContactInfo(theWindow, theRow)
	tell theWindow
		set contents of data cell 1 of theRow to contents of text field "name"
	end tell
end getContactInfo

I can only assume that there is some issue with the getContactInfo() subroutine and that it just isnt adding data to the row.
Any ideas?
JO

Maybe you missed some name in IB…
Check this thread: http://bbs.applescript.net/viewtopic.php?t=4859

Yeah that was exactly it… i found that i need to add a name to the identifier of the column late last night :smiley:
thanks for your help!
I appreciate it greatly,
JO