Panel Window is attached to wrong window.

I have a strange issue. I have a “Preferences” window which is loaded from the main menubar. However, my application opens and closes windows based on the version of OS X it detects on launch.

So, if someone where to open the application while running Tiger, the preferences window opens correctly attached to the window loaded for OS X 10.4.

However, if someone opens then application while running Panther, the preferences window generates an NSReceiverEvaluationScriptError 4 (1) because I’ve closed the Tiger window during the launch process. When the Tiger window wasn’t closed at launch, but just not displayed, the preferences window would open attached to the “invisible” Tiger window, looking strange and disembodied.

I know I could probably place a button on the TIger window and the Panther window and get to the Preferences window that way, but I like accessing the preferences in the main menu bar.

Any hints on how to make it work with both?

The HIG states that preferences windows should be modeless (that is, it should not require the user to dismiss it before interacting with anything else onscreen). a sheet is modal (that is, the opposite of modeless), and thus discouraged.

Off the top of my head, I’m not sure how to handle this. Are you using AppleScript code that runs when the preferences menu item is chosen? If you are, it would be nice to see it.

Side note: Going back to the use of a modeless window. do you know that you can make a window appear “ without using any code “ by settings up connections in Interface Builder?