NSOutlineview Help

Hello,

I can’t seem to find any info on Outlineview’s for applescript studio and how you create the data rows and append to them and all the rest. Does have any info or know where there is a tutorial on this topic. I can find lots of stuff on NSTableview but not outline views.

Any info or exampl code would be appreciated,
Thanks
Dallas

If you’re going to populate the outline view from a list, it needs to be a list of nested lists, each of which is a row. Here are some examples:

set content of outline view 1 of scroll view 1 of window 1 to {"One", "Three"} --Two rows
set content of outline view 1 of scroll view 1 of window 1 to {{"One","Two"}, {"Three","Four"}} --Two rows and two columns
set content of outline view 1 of scroll view 1 of window 1 to {{"One", {"Two"}}, {"Three", {"Four"}}} --Two rows, each with sub-items
set content of outline view 1 of scroll view 1 of window 1 to {{"One", {"Two"}}, {"Three", {"Four", "Five"}}} --Like the last one, but the last entry has two columns.

Outline views are really hard, in my opinon. Good luck!

Thanks for the reply, appreciate it.

Is there a way to append to the data that’s already been added or do you have to just keep adding on to the set contetn command

Also do you know how to extract one valu back to a variable. For ex.

If I set a parent and two children, how do I extract the second child name to a variable.

thanks
Dallas

Please disregard this post, Of cource 30 seconds after I posted I realized that I had to add the name to the Columns and attached the columns to the Nib in interface builder. I didn’t realize that I had to do this with the columns as well. I had only done it with the NSOutlineview and NSScroll view.

Dallas

Hello,

I am stil trying to get an outline view working the way I want but I am having trouble populating the Outline view with text. I have this bit that I am trying to learn with but when this code loads into the window it doesn’t display any text in the data cells. It does show the expand arrow so I would assume that it is creating the columns and cells correctly. Does anyone know why I wouldn’t be seeing text.

Thanks
Dallas

on awake from nib theObject
	set thedatasource to make new data source at end of data sources with properties {name:"id"}
	set f to "File Name"
	set e to "Episode Name"
	tell thedatasource
		make new data column at end of data columns with properties {name:f}
		make new data column at end of data columns with properties {name:e}
	end tell
	
	set parentItem to make new data item at end of data items of thedatasource
	set contents of data cell f of parentItem to "Coming Up ID"
	set childItem to make new data item at end of data items of parentItem
	set contents of data cell f of childItem to "Dallas"
	set the data source of outline view "ov1" of scroll view "sv1" of window "main" to thedatasource
	
end awake from nib

I still see you have no answer.

You must name the columns in IB exactly the same as the columns in your data source. This is not necessary for Table Views but it is for Outline Views.