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)