I just registered, so please be kind
I am feeling a pretty dumb, I recently started ASOC, but I cant figure out how to solve this.
Simple situation: I have a button, which opens a file-browser and wants you to select a file.
Then the POSIX file path is transfered to a textfield. Later I want to retrieve the text of the textfield.
property TextField: missing value
on chooseFile_(sender)
set file to choose file of type {"app"}
TextField's setStringValue_(POSIX path of file)
end chooseFile_
So, this is my code.
Lets say I want to have another button which simply shows the value of “TextField”
on button_(sender)
display dialog "The value is" & TextField
end button_
But this doesn’t work, I also tried “& TextField’s StringValue”.
So how do you retrieve any value of properties?
file is a reserved word, so just use theFile or something similar.
property textField: missing value
on chooseFile_(sender)
set theFile to choose file of type {"app"}
textField's setStringValue_(POSIX path of theFile)
end chooseFile_
Note: conforming to the naming convention variables and instances (like textField) are supposed to start with a lowercase letter