Dialog Box Glitch using X to Close

Hi all,

I am running ND7.02 with 7.02 Designer. (have not tested on other versions)

I have been having a problem Cancelling out of a Dialog box.

The dialog box is called from a View Action.

Call workspace.DialogBox(“CatVoyage”,True,True,True,True,True,False,“Selection”,True,True,True)

This sizes to table and hides OKCancel and prevents values being saved in document.

When a user clicks on the X - the code in a Button with Button Property of Cancel is run.

In my case I was setting a field value. Field process := “0”

The value was saved directly into the Highlighted document in the view. Over-riding the dialog switch to prevent return values.

When Debugging, clicking the X to close the Dialog box produces an error ’ Cannot execute specified command ’

The process then works and does not process the code !!!

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:

  1. 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.

  2. 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”).

  3. 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.

Subject: RE: Dialog Box Glitch using X to Close

The whole problem was I did not realise that Buttons had different settings.

I had 2 Buttons with the property of Cancel.

Once I only made the Cancel Button with the property of Cancel and all others the property of OK, the problem was solved.

I am using LS on Close as the information is placed into a profile document on another server and DB. This is not hardcoded, the LS will call other scripts to figure out where the Profile DB exists.

Cheers

Paul

Subject: He said it was a VIEW button

I’d like to know why you don’t just use formula language?

Subject: Use Formula Language…