Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Using the object-oriented features of LotusScript (The EnhancedUIDoc class)

[Back to "Using the object-oriented features of LotusScript"]

The EnhancedUIDoc class

Class EnhancedUIDoc
    Private m_uidoc As NotesUIDocument    
    Private m_uiw As NotesUIWorkspace    
    Private m_origvalues As BetterList    
    Private m_doctype As String

    Sub ProcessPostopen( Source As NotesUIDocument )    
        Dim doc As NotesDocument        
        Dim ltm As ListItem
	
        Print ("EnhancedUIDoc - ProcessPostopen")
	
        Set doc = m_uidoc.document        
        Forall i In doc.Items        
            Set ltm = New ListItem( i.Name, i.Values(0) )            
            Call m_origvalues.AddItem(i.Name, ltm)
        End Forall
	
    End Sub

    Sub ProcessQuerysave(Source As Notesuidocument, Continue As Variant)    
        Dim doc As NotesDocument        
        Dim ltm As ListItem        
        Dim rval As Integer        
        Dim v As Variant

        Print ("EnhancedUIDoc - ProcessQuerysave")        
        rval = continue
	
        Set doc = m_uidoc.document        
        Forall i In doc.Items        
            Set v = m_origvalues.GetItem(i.Name)

    
            If (Not  Isnull(v) ) Then   'make sure there's an item to compare it to            
                Set ltm = v                
                If i.Values(0) <> ltm.value Then                
                    Print "Item " & i.Name & " new value = " & i.Values(0)                    
                    rval = True
                Else                
                    Print "Item " & i.Name & " not changed."
                End If
            Else            
                    Print "Item " & i.Name & " not found."
            End If

    
        End Forall
	
        Continue = rval
    End Sub

    Sub new (uid As NotesUIDocument)    
        Print ("EnhancedUIDoc - sub new")
	
        Set m_uiw = g_wks		        
        Set m_origvalues = New BetterList        
        Set m_uidoc = uid
	
        On Event Querysave From m_uidoc Call ProcessQuerysave        
        On Event Postopen From m_uidoc Call ProcessPostopen
	
    End Sub

    Sub Postopen(Source As Notesuidocument)    
    End Sub

    Sub Querysave(Source As Notesuidocument, Continue As Variant)    
    End Sub 
End Class