updating text field in window tab view?

I’m not sure what I’m doing wrong. I’ve got a preferences window with tabbed views for collecting preferences for an application. I can’t seem to get one of the text fields to update after using an open panel. (My code is based in the Archive Maker application that comes under the example apps. The only difference is that I’m working with a window not a drawer of a window.) Any ideas would be appreciated.

on panel ended theObject with result withResult
	global irisLocation
	-- The Preferences window IRIS location choose button was clicked and a directory location was chosen.
	if theObject is the open panel then
		if withResult is 1 then
			set irisLocation to item 1 of (path names of open panel as list) as text
			set contents of text field "irisLocationField" of tab view item "irisTabFields" of tab view "prefWindowTabs" of window "prefWindow" to irisLocation as text
		end if
	end if
end panel ended

And for those that want to see the window that prompts for the directory location:

--Prompts the user to select the location where the IRIS application lives that should have the data imported.
on chooseIrisLocation()
	--Setup the open panel properties
	tell open panel
		set can choose directories to true
		set can choose files to false
		set prompt to "Choose"
	end tell
	display open panel attached to window "prefWindow"
end chooseIrisLocation

Thanks in advance,
Jack

Well, I figured out the problem by putting some log statements in the different event handlers. I thought I’d share what I discovered.

In order for my preferences window to execute the code in the event handler “on panel ended”, I had to tell the window in Interface builder to process that event by checking off the panel ended (under panel) event handler and then selecting the name of the script file below. (This is all under the applescript option in the “Show Info” window.)