User Defaults & Disabled Text Fields

I’m trying to figure out how to tie a disabled text field to user defaults; here is my scenario. I have a button that presents the user with a open panel asking them to select a folder. In the panel ended handler I set the contents of the text field to the value as a string. I need to figure out how to bind that text field though. Below is the code I am currently using.

Any thoughts?

on set_choose_folder(thePrompt)
	set can choose directories of open panel to true
	set can choose files of open panel to false
	set prompt of open panel to thePrompt
	display open panel attached to window "w-main"
end set_choose_folder

on panel ended theObject with result withResult
	if withResult is 1 then
		if prompt of theObject is "Choose Themes Folder" then
			-- set themeFolder to (path name of open panel) as POSIX file as text
			-- set contents of text field "tf_themes_path" of tab view item "tvi_settings" of tab view "tv_main" of window "w-main" to themeFolder
			set contents of text field "tf_themes_path" of tab view item "tvi_settings" of tab view "tv_main" of window "w-main" to (path name of open panel) as POSIX file as text
		else if prompt of theObject is "Choose Jobs Folder" then
			set jobFolder to (path name of open panel) as POSIX file as text
			set contents of text field "tf_jobs_path" of tab view item "tvi_settings" of tab view "tv_main" of window "w-main" to jobFolder
		end if
	end if
end panel ended

Hi James,

the value of a text field is accessible even if the field is disabled.
You can use the normal “glue code” to read and write user defaults or Cocoa bindings