Hi,
I'm trying to figure out how to positively close a palette window that has both an X in the upper right corner and a Close button. The reason is that I want to use the Window.find() method to determine if the window already exists when someone attempts to launch it, such that duplicate palettes cannot be produced, for example
var graphicUtilsDlg = Window.find ("palette", "My Graphic Utilities");
if(graphicUtilsDlg != null) return;
So, I define this palette as graphicUtilsDlg, but before I do, I call the method above to see if a current instance exists.
On the palette, I have a Close button tied to the following callback:
graphicUtilsDlg.closeBtn.onClick = function()
{
graphicUtilsDlg.close();
graphicUtilsDlg = null;
};
...and the following callback which is invoked by the close() method above and also when the X is clicked:
graphicUtilsDlg.onClose = function()
{
graphicUtilsDlg = null;
};
It works fine when I click the Close button. The window closes and the next attempt to open it works normally. However, it does not work properly when I click the X button. It takes two attempts before the window opens again. Somehow, the find() method is returning an object the first time, but not the second time.
Anyway, I know this is a bit windy and complex, but does anyone have any expertise here?
Thanks,
Russ