Using return key to start action

I’ve got a app that checks that compares the content of a text field to the content of a user default. If its the same, it just closes the panel. If it is different, it relaunches the application.
The problem I’m having is that using the Return key does not trigger the relaunch if the content is different. If I click the “atc-save” button, it works fine but not by hitting Return. I do have the return key set in the Attributes window.
Any ideas? Here is my code, although I’m not sure this is the cause.


on clicked theObject
	if name of theObject = "atc-save" then
		display dialog "ok"
		
		--If repeatTime text field is the same as repeatTime preference, close panel.
		if content of text field "repeatTime" of window "prefs" is equal to repeatTime then
			close panel (window of theObject)
		end if
		
		--If repeatTime text field differs from repeatTime preference, relaunch program
		if content of text field "repeatTime" of window "prefs" is not equal to repeatTime then
			tell window of theObject to set first responder to theObject
			close panel (window of theObject)
			display window "relaunching" attached to window "MPA2PMP"
			delay 1
			close panel (window 1)
			
			set shScript to "sleep 2; open " & quoted form of POSIX path of (path to me)
			do shell script "echo " & quoted form of shScript & " > /tmp/l" --> store in temp file
			do shell script "chmod 755 /tmp/l; /tmp/l > /dev/null 2>&1 &" --> execute it "ignoring responses", and quit
			quit
		end if
	end if
end on clicked

Also, I have a trigger that disables a Cancel button on this panel if the content has changed. After closing the panel, it does not re-activate the button the next time the panel is triggered. It’s as if closing the panel doesn’t release it so it will have a fresh start next time it’s triggered. Is this something that can be fixed?

NOTE: I am on Leopard, running Xcode and IB 3.

Thanks in advance,
Chris

Model: Powerbook G4
Browser: Safari 523.10
Operating System: Mac OS X (10.5)

I have still had no luck in finding a work-around. I created a small app for testing purposes and it is not working there either.

on clicked theObject
	if name of theObject = "test" then
		display window "prefs" attached to window "main"
	end if
	
	if name of theObject = "check" then
		set didThisChange to contents of default entry "didthischange" of user defaults
		tell window of theObject to set first responder to theObject
		
		if content of text field "input" of window "prefs" is not equal to didThisChange then
			display dialog "You changed the field"
			set contents of default entry "didthischange" of user defaults to contents of text field "input" of window "prefs"
			close panel (window of theObject)
			
		else
			display dialog "Nothing changed."

		end if
	end if
end clicked

Let me pose a different question: Can I bind the text field but keep it from writing until the “on clicked” statement?

Well, didn’t get any help on this one but I did manage to get it working.

I basically had to kill all bindings and code my user defaults instead of letting Cocoa Bindings do it for me.