1 pref to mulitple text fields

Howdy all,

I’ve finally got all this pref stuff worked out. So now onto the next step. (I’m bascially building my prefs first, from what I know I’ll need, so that I don’t have to throw in any more than I need for coding)

What I’d like to do is in my prefs window (Which, ideally, would automatically show itself when the app runs the first time only, but that whole “first_time is true” thing isn’t working. Any advice on this one?) is have the user define several variables by selecting a folder using the browse button. The returned folder then shows its path in the corrisponding text-box. That path is then set to a variable, and a pref key, so it is remembered for future runs. That much I’ve accomplished.

The thing I’d like to do is have the same folder path that was defined by the user show up in all of my text boxes where that information would be relevant (text1 in tab1, text2 in tab2, and text3 in tab3, for all intensive purposes) across several tabs. I’ve tried using the “on will close” handler, but that returns an error, 4 (1), which the meaning escapes me at the moment.


on will close theObject
if name of theObject is "PrefsWindow" then
set contents of text field "text1" of tab view item "tab1" of tab view "tabwind" of window "myapp" to MemLoc as Unicode text
	set contents of text field "text2" of tab view item "tab2" of tab view "tabwind" of window "myapp" to MemLoc as Unicode text
	set contents of text field "text3" of tab view item "tab3" of tab view "tabwind" of window "myapp" to MemLoc as Unicode text
end if
end will close

Is there a way to do this simply? Or am I just barking up the wrong tree?

Thanks,
-Parrot

Have you tried using Bindings (requires OS X v10.3 or later)? If not, have you tried updating those values right after the preference is changed?

Had to do a bit of both actually. It wasn’t too fond of updating the boxes automatically as soon as the value was changed, so I had to write the new value to the prefs right after making the selection.

Well, hey, if it works…

Thanks again :slight_smile: