SOLUTION: Embedded View and Refresh causes crash. Peter Szoldan 7.Jun.09 07:39 PM a Web browser Domino Designer All ReleasesAll Platforms
OK, I finally got it working. Main idea: start a NotesTimer with 1 sec intervals (the minimum) in the original UIDoc that polls the UIDoc.Document for an item "RefreshNeeded" every second; if the item is available, it refreshes the document, and removes the item (to avoid multiple refreshes.)
I clicked it like crazy for a while and it crashed only once out of 100 times. Removed the "Automatically refresh fields" setting in the form (thinking it might also be triggered and the two would interfere) and it doesn't seem to crash any more but no guarantees.
The refresh happens in 1/2 seconds on average, and 1 sec at max, which is reasonably usable as I tested it.
The empty NotesTimer (just running, not refreshing) doesn't seem to have a measurable effect on my CPU usage, so I believe it's safe to use.
Form Globals (Declarations): [important to put it here and not in the Events script (Declarations) ]
Dim nt As NotesTimer
Dim thisUIDoc As NotesUIDocument
Form Postopen event:
Set thisUIDoc=Source ' I'm saving this for performance reasons - to avoid looking it up for each Alarm
Set nt = New NotesTimer(1)
On Event Alarm From nt Call TimerHandler
Create TimerHandler Sub under the Form event script:
Sub TimerHandler(Source As NotesTimer)
If thisUIDoc.EditMode Then ' I only need this when the doc is edited
If Not thisUIDoc.Document.GetFirstItem("RefreshNeeded") Is Nothing Then
Print "Refreshing - "+Now() ' for debugging
Embedded View script, either in an action or an event script:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument