I’m having a little trouble with the showing and hiding windows.
When the program launches, my MainMenu nib is automatically loaded with all the windows I need. At some point the user makes a request to bring up a window and I use ‘show window’ to show the window that was loaded from the nib.
But it appears that when the user clicks the go-away box of that window, it causes the window to unload from memory. If they request the window again and I try to use “show window” it fails.
If I use ‘load nib’ before calling ‘show window’ everything works just fine.
THE QUESTIONS:
Is there a simple way to tell the window NOT to unload when it’s closed?
Can I stop the window from closing and then tell it to hide instead?
Do I have to always load the nib before showing it?
Always loading the nib seems a little counter intutitive since I would then need a different nib for every window type just so I could load it (and it alone) before showing the window.
Try attaching a should close handler in the window’s Show Info–>AppleScript pane:
on should close theObject
tell theObject to hide
end should close
I thought the additional line return false might be required, but on cursory experimentation it seems to work either way (maybe return false would be necessary if the hide command were implemented in a will close handler?)