Text field in a drawer

Hi everyone!

I am having trouble…
I have a text field in a content view in a drawer, and I want to change the contents of the text field. How would I reference it?

I have tried these two things:


on clicked theObject
	if name of theObject is "A" then
		set the (title of text field "element name" of drawer "info drawer" of window "main") to "A"
		end if
end clicked

and this:


on clicked theObject
	if name of theObject is "A" then
		set the (contents of text field "element name" of drawer "info drawer" of window "main") to "A"
		end if
end clicked

I’m still learning AppleScript Studio, so forgive me if I act noobish.
:o

Thanks

What happens if you word it like this?

on clicked theObject 
   if name of theObject is "A" then 
      set contents of text field "element name" of drawer "info drawer" of window "main" to "A" 
      end if 
end clicked

If that doesn’t work, I’d check to be sure that “element name” is, in fact, a text field and not something else like a scroll view. Fields can be a bit confusing.
Regardless, I think it’s ‘contents’ that you’re trying to work with here.

Thanks, but I decided to do it differently in the mean time. I’ll remember that for future use. :slight_smile:

Yes, on referencing fields I had on a few occasions mislabeled text fields and text views. Sometime I still muck up the text view of “somename” of scroll view “somename”. I don’t know why it just doesn’t seem right to reference twice. Afterall by that example I would be trying to use the scroll view “somename” so what would make calling it a text view different? Oh well…