Embedded views and NotesUIView

I ran into a situation where the current view (Notesuiworkspace.currentview) wasn’t available in some circumstances for an embedded view (edit mode), but it was in others (read mode). I got around this by keeping a global handle to the UIview. I obtained this in the PostOpen event.

I’m hoping this will help others who have run into problems with accessing embedded views.

This code fails in Edit mode when run in a form action button in a document with an embedded view. It work in Read mode.

Dim wks As New NotesUIWorkspace

Dim UIview As NotesUIView

Set UIview = wks.CurrentView

Set view = UIview.View ’ “Object variable not set” error occurs here

This code works in the same circumstances (where globalNotesUIView is set from the workspace in the form’s PostOpen)

Dim wks As New NotesUIWorkspace

Dim UIview As NotesUIView

Set UIview = globalNotesUIVw

Set view = globalNotesUIVw.View

Anyone else run into this problem? Is keeping a global handle to the UIView risky in any way?

I’m using Windows XP SP2 and Notes 6.5.2