I have an app that uses two windows. One lets you enter some details, then you hit Done it disappears: your entry is shoved into a table on the other window. When you go to make a new entry, the ‘add’ window is called up again but it still has all the old entries in it.
Now, you can set all fields to empty through code, but is there a better way of doing this? Reloading the nib somehow?
No there’s no “better” way. I’m not sure how I see what’s so difficult about resetting the fields. While it’s a bit of coding, even with 100 text fields you still could generate the code in only a couple minutes. What I might recommend is putting the code in a subroutine, which could then be called from any number of places in your application when required. In this case, the “will open” handler of the window would be an ideal place.
on will open theObject
if name of theObject is "inputWindow" then
end will open
tell window "inputWindow"
set content of text field "input1" to ""
set content of text field "input2" to ""
set content of text field "input3" to ""
set content of text field "input4" to ""