Another option, assuming that the dialog is associated with a specific document - and, thus, you might want to have multiple instances, just not more than one per document - would be to store a mapping of document IDs to dialog IDs in a global array, and consult it before creating a new window.
global DIALOGS[];
function show_my_dialog(doc=current_doc()) {
if ($DIALOGS[doc] && window_valid($DIALOGS[doc])) {
# Dialog already exists
window_activate($DIALOGS[doc]);
return;
}
local dlg = … # create dialog
$DIALOGS[doc] = dlg;
}
Chris
Chris Nitchie
Oberon Technologies, Inc.
2640 Wildwood Trail
Saline, MI 48176