Discovering an object's tab view

Hello,

I recently converted from using a window to a tab view and am having a problem.

My one of my tab view items “tab1” has a button “add” and a text field “name”. When the button is pressed the clicked event handler gets the “add” button in passed in theObject.

Now what I want to do is read the contents of the "name’ text field located in that same tab “tab1”.

if instead of a tab view I had a window I would normally say:

set theWindow to the window of theObject
tell theWindow
set theText to the content of the text field “name”
endtell

What is the equivalent statement for a text view?

I tried a lot of guesse the most rational of which are:

set theView to the text view item of theObject
tell theView
set theText to the content of text field “name”
endtell

or

set theView to the text view of theObject
tell theView
set theText to content of the text field “name”
endtell

but no luck.

I can set successfully the textfield contents like this:
set the contents of text field “name” of tab view item “tab1” of tab view “TZ” of window “winney” to “blort”

AppleScript: 1.2 (latest)
Browser: Safari 412.2
Operating System: Mac OS X (10.4)

oops I made a huge typo in the above. I meant to say “tab view” not “text view”.

thus it should have read:

What is the equivalent statement for a tab view?

I tried a lot of guesses the most rational of which are:

set theView to the tab view item of theObject
tell theView
set theText to the content of text field “name”
endtell

or

set theView to the tab view of theObject
tell theView
set theText to content of the text field “name”
endtell

but no luck.

I can set successfully the textfield contents like this:
set the contents of text field “name” of tab view item “tab1” of tab view “TZ” of window “winney” to “blort”

Something like this should work:

on clicked theObject
	set theText to text field "name" of (super view of theObject)
end clicked

Cool. and thank you. Applescript studio reference (apple.com) has no explanation of that so that was really helpful. I did not realize the “super” referred to the container object–usually super refers to the parent in an inherited class and “isa” != “hasa” != “containsa”.

is this documented somewhere? Why is the syntax different for views than for getting windows containers?

in any case I wrote a small script to demo some of the other “super” views one has:


on clicked theObject
	set theName to the name of theObject
	if theName is "go" then
		set theTabItem to the super view of theObject
		set theTabview to the super view of theTabItem
		
		set theText to text field "name" of the theTabItem

		display dialog "the name selected is " & content of theText & " it was in tab " & name of theTabItem & " found in " & the name of theTabview
	end if
	
end clicked

Okay I grepped the applescript command reference and the applscript studio application guide for super and came up with zero hits. Where is this command documented?

In any AppleScript Studio project, you should see an item called AppleScriptKit.sdef. This is the dictionary that your application will support. Open it and look under Contain View Suite > view. You should find this:

super view (view) : the view that contains this view

While you’re at it, check out some other classes, like button (under Control View Suite). You should see the classes it inherits from at the top (control > view > responder > item). Note that a button is also a view, so it has a super view property.

If you look at the window class (under Application Suite), you’ll notice it is not a view, and that it does not have a super view property.