I have set up in Interface builder a main application window called “main” in the AppleScript info panel tab, and a simple preferences panel called “preferences”. the "preferences panel has a text field input for username and one for password and a button named “prefSave”.
I attached a handler to the “Preferences” menu item (command + ,), giving it a name of “menuPref” by stating:
on choose menu item theObject if name of theObject is equal to "menuPref" then set xmlPrefs to window "preferences" display panel xmlPrefs attached to window "main" end if end choose menu item
This works great, but I can’t close the attached panel!
In fact, the entire AppleScript Studio application gets “stuck” with the preferences panel attached to the window “main” and I am unable to quit (I have to force quit).
I have an on clicked section for my app and a handler for when the “prefSave” button is clicked.
else if name of theObject is equal to "savePref" then set xmlPrefs to window "preferences" close xmlPrefs
the preferences are saved using bindings and an instance of Shared Defaults, but I don’t know how to get this darn panel to close when the user is finished entering or changing data. This entire system works fine if I get rid of the "attached to window “main” part, but It is such a tiny little panel that I would rather just drop it out of the main window than open up a separate window.
Any idea what I am doing wrong that this won’t close?
Dr. Scotty Delicious, Scientist.