When using the workspace.Prompt method with PROMPT_OKCANCELLISTMULT is there no way to tell the difference between:
1/ The user clicking Cancel.
2/ The user unselecting everything and clicking OK.
These two operations are very different logically yet this method returns exactly the same result in both cases, so there is no way to tell the difference.
Subject: Prompt multiselect. No way to tell whether user cancels or deselects everything???
I’m not sure I’m totally with you, but are you saying your code can’t tell the difference between no selection and an empty variant representing the prompt? If so, this is a common issue. I’ve covered it in an article on my site if you’re interested: Tip #9: Empty Variants
Subject: RE: Prompt multiselect. No way to tell whether user cancels or deselects everything???
Ben,
I don’t think your tip addresses telling the difference between Cancel and “OK with no choices,” which was the original question. It just talks about distinguishing between the user making a selection and not making a selection.
Also, I don’t know what the situation is with Notes 5, but in Notes 6 I tried the code below, and there was no difference in the behavior of variables dimmed with no datatype vs. “as variant”. You might want to test again and update your tip.
To answer the original question: I tried and I also couldn’t find a way to distinguish between the two cases of Cancel and OK with no selection. As a workaround, this download contains design elements that implement a LotusScript version of @Prompt where you can tell the difference. It uses DialogBox method rather than Prompt.
Sub Click(Source As Button)
Dim a
Dim b As Variant
Dim ws As New NotesUIWorkspace
Dim choices
choices = Split("a,b,c", ",")
’ a = “x”
’ b = “x”
a = ws.Prompt(PROMPT_OKCANCELLISTMULT, "title", "prompt", "", choices)
b = ws.Prompt(PROMPT_OKCANCELLISTMULT, "title", "prompt", "", choices)
If Isempty(a) Then Print "a empty"
If Isempty(b) Then Print "b empty"
Print "a = " & debugstr(a) & ", b = " & debugstr(b)
Subject: RE: Prompt multiselect. No way to tell whether user cancels or deselects everything???
Yeah, my bad. Oh well, may be of use to someone.
It’s purely R5 yes, I haven’t had time to test in ND6. It’s pretty bad that the code needs to do this to test for an empty variant in every version of R5 though.