'#Language "WWB-COM" ' Title: ' M4 sample - Transactions 1 ' © 2015 Harport Consulting ' Create a new map and run a transaction to update it Option Explicit Dim WithEvents m_Trans As Transaction ' Transaction object Sub Main Dim m_Document As Document Set m_Document = AllDocuments.Add ' start a new document Set m_Trans = m_Document.NewTransaction("My transaction") ' Kick off transaction If Not m_Trans Is Nothing Then m_Trans.Start Wait(0.1) ' Wait for it to finish While m_Trans.IsExecuting Wait (0.1) Wend Set m_Trans = Nothing End If Set m_Document = Nothing End Sub Sub m_trans_Execute(ByVal m_Document As Document) ' Update the document inside the transaction event, while ' map updates to the user interface are suspended Dim m_Topic As Topic m_Document.CentralTopic.Text = "New document" ' Add a subtopic to the central topic Set m_Topic = m_Document.CentralTopic.AddSubTopic("New topic") m_Topic.Task.Priority = mmTaskPriority1 ' set priority 1 map marker End Sub