R6.5 Lotuscript DialogBox Method Broken?

I get the following error:

“DialogBox cannot be used in this context; a document must be selected.”

when I select a document and execute the following code:

Sub Initialize

Dim session As New Notessession

Dim ws As New NotesUIWorkspace

Dim db As Notesdatabase

Dim dummy As NotesDocument

Dim flag As Integer



Set db = session.currentDatabase

Set dummy = db.CreateDocument



flag =  ws.Dialogbox("(ArchiveDialog)",True,True, False,True,True,False,"Spec Arch Action",dummy)

End Sub

I get the error when the document is highlighted in a view, explicitly selected in a view or open.

The syntax for the dialogbox method was verified in the help doc.

Did they break the DialogBox method in 6.5?

Subject: R6.5 Lotuscript DialogBox Method Broken?

Based on some of the other responses, I recreated my ‘dialogbox’ form as a subform and bang, everything started working again. This follows our usual standard, so I don’t know why I changed. (All dialogbox forms are subforms with the dlg prefix in front)

Hope this helps others solve this same irritating error. Lotus needs to review this functionality very closely.

Subject: R6.5 Lotuscript DialogBox Method Broken?

Check the form name CAREFULLY – there’s one and only one error message for the dialogbox, and anything that goes wrong triggers it. Others who’ve had this problem have usually had the form name misspelled.

Subject: RE: R6.5 Lotuscript DialogBox Method Broken?

A form name misspelling brought me to this post.

Thanks yet again to Stan.

Subject: RE: R6.5 Lotuscript DialogBox Method Broken?

Had code that was running in 6.01CF1 - which now raises the “4416 DialogBox cannot be used in this context; a document must be selected” error" after migrating to 6.50 client/server. I’m going to check technotes - but suspect too early for that.

thanks,

Berkley

Subject: RE: R6.5 Lotuscript DialogBox Method Broken?

I’ve experienced the same migration problem. LS code which called a dialogbox from the notesuiworkspace and worked in 6.01 is now giving me the “DialogBox cannot be used in this context; a document must be selected” error. Reading about corrupted forms, etc, I created a new subform with some simple text on it and a new action button. Calling it via formula works, but I get the error in lotus script, using code:

Dim ws As New NotesUIWorkspace

Call ws.DialogBox(“AddTime”, True, True, True, True, False, False, “Add Pay Period Categories”,False,True)

Keep me posted if there’s a solution coming.

-BDS

Subject: R6.5 Lotuscript DialogBox Method Broken?

I have the same problem migrating a complex application from R5 to R6.5. We make extensive use of dialog boxes based on documents created ‘on the fly’ in script. As this works fine in the live system I assume that there are no errors in the dialog box or code. It appears simply that you cannot access an unsaved or unselected document via the dailog box. This is a huge removal of functionality and is a show stopper for us.I am busy trying to find a way around this that does not involve extensive re-development. Is this seen by the Lotus developers as how the functionality should work or will a fix be provided?

Subject: RE: R6.5 Lotuscript DialogBox Method Broken?

I had the same error where I was calling uiws.DialogBox(“MyForm”, true, true) in a PostOpen event. The exact same code worked fine in R5 client, but in ND6.5 client it would produce this error. I recreated a new form specified in DialogBox, but this still didn’t fix the problem.

I eventually got this to work by changing the code from:

uiws.DialogBox(“MyForm”, true, true)

to

uiws.DialogBox(“MyForm”, True, True, False, False, False, False, “Prompt”, docCur)

where docCur is the current NotesDocument.

Not sure why this is different in ND6.5.

Subject: Corrput form

The form used for the dialog box was corrupt. This has been corrected and the dialog box works fine on the temporary document