I struggled with the usage of SetTargetFrame. I opened a document in the left frame in a frameset with two frames. Then I opened a second document in the right frame in the same frameset using
Call uiws.SetTargetFrame("Frame2")
Afterwards, several other functionalities that use NotesUIWorkspace.EditDocument to open other documents caused errors or even crashed Notes. These functionalities worked before I added the new frameset.
The solution was to
Call uiws.SetTargetFrame("_blank")
where the parameter "_blank" is not in the product documentation. It is only documented that no frame should be called "_blank": https://help.hcltechsw.com/dom_designer/12.0.2/basic/H_ADDING_CONTENT_TO_A_FRAMESET_STEPS.html?hl=_blank
I did not expect that the focus was still on "Frame2" when processing the code in a totally different action button.
Long story short: Please update the product documentation by clarifying that SetTargetFrame permanently sets focus to a frame and that you can remove that focus by using the parameter "_blank".