making a queue

i’m trying to make a queue for my video converting program. all i need help with is getting the title of current menu items in 2 popup buttons, and the content of a text field, all on the same window, then put each into a column in a table which is in a panel. any help? thanks.

bump

I would start by getting the title of current menu items in 2 popup buttons. Then, I would get the content of a text field. I would make sure that they’re all on the same window. Then, I would recommend that you put each into a column in a table which is in a panel.

Hope that helps,
j

lol, i guess i wasnt very explanitory in my first post, i got all the contents and everything, but how do i set each one to a different column in a table view, thats where i’m stuck.

Hi fiftyfour123

Theirs three good examples to do with “Table” projects in the folder "your hard drive/Developer/Examples/AppleScript Studio, that you could use to get you started. Table, Table Reorder, Table Sort.

Budgie

i just look at all of them and they dont make any sense to me, they never reference the text fields…

bump

sorry to bimp an old topic but, i moved the table view to the main window and i used this code to add stuff to it.

	
on clicked theObject
		tell window of theObject
				set queue to queue & {my getContactInfo(window of theObject)}
				set the contents of table view "queue" of scroll view "queue" to queue
end clicked

on getContactInfo(theWindow)
	tell theWindow
		return {theLink:contents of text field "text", thePreset:title of current menu item of popup button "popup", theDowhat:title of current menu item of popup button "dowhat"}
	end tell
end getContactInfo


and when i click on the button it doesnt add any text to the table view. but it does add something cuz i can click on the first row and it will highlight it which means it did add something but i cant see it.

Perhaps you need to force the table view to update?

tell table view "queue" of scroll view "queue" to update

nope, that still creates an empty row in the table.

bump

fiftyfour123,

Tables (and outline views) are, in my opinion, the hardest parts of AS Studio. Mostly because there are 2 different ways to implement them, with a data source and without one. Beyond that, there are 2 ways to use a data source, by connecting one in Interface Builder to your table and by creating one through Applescript’s “make new data source” command.

First, are you using a data source? If so, things are much easier from the perspective of adding/removing items in the table.

If not using a data source, things are harder but you have more control over how the data is presented. The “harder” part is that you have to provide handlers for number of rows (just return the number of rows in the table), cell value (return the value for a given cell) and cell value changed (make necessary changes when a value changes, for example if you have a “spreadsheet” type app, if one value changes, others may need to be changed). This method is slower, too, since it requires a lot of Applescript to keep it all working.

What I’m getting at is, from the code you’ve posted we can’t tell enough about what you are doing. Can you tell us if you are using a datasource or not? And either way, can you post more code?

well, i’m not using a data source. i have never used one before but i’d be happy to learn an easier way to do this. all i need to do with this table is add things and remove them. when something is added it gets the title of 2 different popupbuttons and the contents of a text field.

as for showing you more code, theres no more code in my project the is part of the table view what i posted was all that has to do with the table view.

here it is again for reference:

property queue : {}

on clicked theObject
	if theObject's name is "add" then
		if enabled of popup button "popup" of window "main" is true then
			tell window of theObject
				set queue to queue & {my getContactInfo(window of theObject)}
				set the contents of table view "queue" of scroll view "queue" to queue
				tell table view "queue" of scroll view "queue" to update
			end tell
		else if enabled of popup button "popup" of window "main" is false then
		end if
	end if
end clicked

on getContactInfo(theWindow)
	tell theWindow
		return {theLink:contents of text field "text", thePreset:title of current menu item of popup button "popup", theDowhat:title of current menu item of popup button "dowhat"}
	end tell
end getContactInfo

Have you ever gotten anything in the table view at all? If you haven’t, I’d suggest changing the table to a list of lists instead of a list of records. I’m 100% sure that works, but I’ve never tried doing a table view with records. In this case, all you have to do is remove the record names in the getContactInfo method. It works so each list is a row. Also, if you’re ever going to get the data out of the table view, use “get content” instead of “get contents”. That little s screwed me up for quite a while :).

You are correct, Noob. If you use records, you MUST name the columns in the table EXACTLY the same name or the table will overlook the data. If you use just a list, it grabs the items one by one, filling the columns from left to right.