• Use the button from inside of a document (not only from a view)

    By rulle rusk 1 decade ago

    Form: CustomShowDocFields2

    Add following:

    Globals/Declaration: Dim uidoc As NotesUIDocument

    Globals/Initialize: Set uidoc = ws.CurrentDocument



    Change following:

    Form/QueryOpen:

    Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

    Const DEBUG = False<br/>
    If(Not ws.CurrentView Is Nothing) Then<br/>
        '### categories starts with '8000'<br/>
        If( Not Instr(ws.CurrentView.CaretNoteID,&quot;8000&quot;) = 1) Then<br/>
            notesID = ws.CurrentView.CaretNoteID    <br/>
            If(DEBUG) Then Msgbox(&quot;NoteID: &quot;+notesID)<br/>
            databasePath = ws.CurrentView.View.Parent.filepath <br/>
            If(DEBUG) Then Msgbox(&quot;DatabasePath: &quot;+databasePath)<br/>
            server = ws.CurrentView.View.parent.server<br/>
            If(DEBUG) Then Msgbox(&quot;Server: &quot;+server)<br/>
            Exit Sub<br/>
        End If<br/>
    Elseif (Not uidoc Is Nothing ) Then<br/>
        notesID = uidoc.Document.NoteID<br/>
        If(DEBUG) Then Msgbox(&quot;NoteID: &quot;+notesID)<br/>
        databasePath = uidoc.Document.ParentDatabase.FilePath<br/>
        If(DEBUG) Then Msgbox(&quot;DatabasePath: &quot;+databasePath)<br/>
        server = uidoc.Document.ParentDatabase.Server<br/>
        If(DEBUG) Then Msgbox(&quot;Server: &quot;+server)<br/>
        Exit Sub<br/>
        <br/>
    End If
    
    • Will be implemented in 0.5.1

      By Timo Emrich 1 decade ago

      Thank you for the piece of code! It works fine :-)



      Timo