Subject: Dialog Box Glitch using X to Close
By X you means the window’s Close box right?
I don’t really know what sort of button it is you’re calling click on. I gather you have a button on the form and that you are somehow arranging for its Click event to be fired when the user clicks the close box. Right so far? And the purpose of this arrangement is to let the calling code know the user canceled the dialog. Also correct?
If all that is right, calling click on a hidden button - which involves calling JavaScript, yes? - seems unnecessarily complex. Try this instead:
-
Put a global boolean variable on the form, and cancel the Queryclose event if this variable is False. Set the variable to True in your various buttons. The effect of this is that the close box does nothing.
-
Put a hidden field called OK Cancel - or somthing similar - on the form with a value of “0”. Your OK button - or whatever - calls .fieldsettext(“OKCancel”,“1”).
-
The calling code examines that hidden field - through the back end of course and considers a value of “0” to mean cancel.
The dialogbox method makes a copy of the current document, displays that in a new window, and then pushes any changes back into the original. If you are using script version you have the option of giving it a different document to work on. This way the dialog won’t write back into your original doc no matter what:
dim dlg as notesdocument
dim item as notesitem
set dlg = db.createdocument
with dlg
call .replaceitemvalue(“Form”,“TheDialogform”)
call .replaceitemvalue(“OKCancel”,“0”)
’
’ copy in other values from your real doc here
’
end with
call notesUIWorkspace.DialogBox( dlg.form(0), [autoHorzFit] , [autoVertFit] , [noCancel] , [noNewFields] , [noFieldUpdate] , [readOnly] , [title$] , dlg , [sizeToTable] , [noOkCancel] , [okCancelAtBottom] )
set item = dlg.getfirstitem(“OKCancel”)
if item.text = “0” then exit sub
etc
The debugger won’t work in dialogs.