从嵌入视图打开的对话框显示对话框窗体,而不是直接返回到嵌入视图

问题描述 投票:0回答:1

我有一个嵌入式视图,在单击视图中的文档时会打开一个对话框。 关闭对话框时(使用保存和关闭或只关闭按钮使用基本的@Commands),而不是刚关闭它的对话框清除屏幕上的底层表单并打开对话框,就像它是一个表单一样。 如果我关闭它,原始的底层形式会重新出现,这就是我想要发生的,而不会出现插入对话框的形式。

这是因为我使用@Function调用@Command([FileSave]); @Command([FileCloseWindow])还是还有其他我错过的东西?表单上是否有我没有设置的标志,或者对话框上的操作是否需要用LotusScript编写,他们必须以某种方式调用表单?

使用以下公式从视图中打开对话框:

Sub Queryopendocument(Source As Notesuiview, Continue As Variant)
    Call OpenDocInDialogBox( Source, True, 1, "frmOrganization", "Organization") 
End Sub

而OpenDocInDialogBox函数是:

Function OpenDocInDialogBox( Source As NotesUIView, Continue As Variant, WhatIfNonEmbed As Integer, Form_Name As String, Dlg_Title As string) As Integer

    Dim DocColl As NotesDocumentCollection
    Dim Doc As NotesDocument
    Dim flag As Integer
    Dim ws As New NotesUIWorkspace
    Dim temp As Variant

    Continue = False
    flag = False

    Set DocColl = Source.Documents 
    Set Doc = DocColl.GetFirstDocument

    doc.IsDialogBox = "Yes"

    If Not ws.CurrentDocument Is Nothing Then 'Checks if it is an embedded view  
        If ws.CurrentDocument.EditMode Then   
            flag = ws.DialogBox( FORM_NAME, True, True, True  , False, False , False , DLG_TITLE, Doc , True, True )
        Else   
            flag = ws.DialogBox( FORM_NAME, True, True, True  , False, False , True , DLG_TITLE, Doc , True, True )   
        End If  
    Else  'open from an action button
        Select Case WhatIfNonEmbed   
        Case 0   
            MsgBox "Sorry.. You cannot open documents From the current view.", 0 + 16, "Warning"   
        Case 1              
            flag = ws.DialogBox( FORM_NAME, True, True, True, False, False , False, DLG_TITLE, Doc , True, True )   
        Case 2   
            doc.IsDialogBox = "No"
            Continue = True    
    End Select  
    End If

    OpenDocInDialogBox = flag

End Function

代码中的标志指的是以下内容

WhatIfNonEmbed tells how to open the document If gets opened From a non-embedded view.
WhatIfNonEmbed=0 ---- Dont Allow users To Open (meaning, doc can be only opened from the form In which it is embedded)
WhatIfNonEmbed=1 ---- Open In Dialog box.
WhatIfNonEmbed=2 ---- Normal Open using the form.
lotusscript lotus lotus-formula
1个回答
0
投票

umeli已在评论中回答,但由于他没有写完整的答案,我会这样做:

QueryOpenDocument事件有一个“继续” - 变量,告诉它,文档是“真正”打开(Continue = True)还是禁止(Continue = False)。

对话框正在阻止。你的代码目前做了什么:

  • 它在QueryOpenDocument-事件期间显示Dialog并暂停该事件直到对话框关闭。
  • 它不会将continue变量设置为“False”:因此,在关闭对话框后,“正常”进程将启动:您的文档将作为新窗口正常打开。

解决这个问题的两种可能性

  1. 正如umeli所说:使用变量“Continue”作为调用的参数,而不是“True”:如果在该函数中显示对话框(或者如果参数类似,则返回true),则将其设置为“false”默认情况下,变量通过引用传递,底层的Continue-变量将被更改,QueryOpenDocument-进程将被停止。 Call OpenDocInDialogBox( Source, Continue, 1, "frmOrganization", "Organization")
  2. 在QueryOpenDocument事件中自己设置Continue = False。同样的效果,但是你的完整的WhatIfNonEmbed = 2 - codepath不再做任何事了。
© www.soinside.com 2019 - 2024. All rights reserved.