Doug Finner 5.Jan.12 03:45 PM a Web browser Domino Designer6.5.4Windows XP
The core of this question is to see if it's possible to determine if a doc was opened directly from a view or if the user is stepping through docs in a view by opening one, then hitting <enter> to get to the next. This is client only and all docs are left in read mode.
Here are the details.
The app is intended to see if a user has been authorized to open a specific document. If they are authorized, then the doc opens, if not, they're alerted that there's a problem via a messagebox and the doc is closed. In this case, 'authorization' is a training record in another Notes app. Reader fields are overkill and likely to be difficult to establish and maintain since access to docs is by person not role and the reader list could get quite long for some docs (and it would be a major rewrite of the app which I'm not looking forward to...)
How it's done:
A subform's queryOpen code tests to see if there is a training record for the user.
If so, the doc opens.
If not, a messagebox pops, the employee's manager gets an email letting them know a training record is required, and continue is set to 'false'.
The problem.
Let's say the user is trained to documents 1-3 out of a set of 5.
They open doc 1, no problem.
Hit <enter> and move to doc 2, no problem.
Hit <enter> and move to doc 3, no problem.
Hit <enter> and move to doc 4...problem.
On the screen, the 'document' tab shows only what looks like the form design background.
There is a 'beep' which turns out to be the messagebox being displayed.
Unfortunately, the dialog box is invisible so to the user, it appears that the system is locked up and they usually reboot.
I know the issue is the message box because if I hit the spacebar, it works just like dismissing any other dialog box via the spacebar. Escape also works to dismiss the invisible dialog box.
I believe the problem is that since the dialog is displayed in the queryOpen event, the previous doc is somehow still hanging around in some sort of way and is stepping on the display of the dialog.
I'd like to be able to handle this case. I'm thinking if I have a way to know that doc 2 was reached via the user hitting <enter> on doc 1, I have an option to not display the messagebox.
I've chosen not to post the code on this; I'm not sure it adds to the discussion because I may be going at this all wrong anyway. The code is LS, client only. I've tried setting environmental variables on queryOpen, postOpen, queryClose, and from the view in an attempt to set a 'where from' variable. In all cases, if the code works when going doc to doc, then the 'open from view' fails to pop the dialog. I'm not able to absolutely say how the user got into the doc.
Any ideas are welcome. My workaround (spacebar) is OK but not very elegant.