ZWSOFT User Community > ZWSOFT Forums - Find. Share. Connect. > ZWCAD > ThisDocument Events on VBA Projects
ThisDocument Events on VBA Projects
06-04-2011 12:03 . pm | View his/her posts only
Hello,
I'm new to ZwCAD. I bought one licence and I'm trying to customise it for our office use.
During this little project I tried very hard to create an event that responds when an object is deleted, added or modified in the current document. I noticed in the VBA Editor that under ZWcad 2011 Professional Objects the ThisDocument object exists. In this class, if I choose zwcadDocument in the object bar I see in its right part the available events.
I created the following code in order to test:
----CODE: Start----
Private Sub ZwcadDocument_Activate()
'Does not work
Me.Utility.Prompt vbCrLf & "Activate" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectAdded(ByVal Entity As IIcadEntity)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Added" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectErased(ByVal ObjectID As Long)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Erased" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectModified(ByVal Entity As IIcadEntity)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Modified" & vbCrLf
End Sub
Private Sub ZwcadDocument_SelectionChanged()
'Works
Me.Utility.Prompt vbCrLf & "Selection changed" & vbCrLf
End Sub
----CODE: END----
From the above only the SelectionChanged event seems to work. Do I do something wrong? If not, why show these events if they don't work? I'm stumbled!
I'm new to ZwCAD. I bought one licence and I'm trying to customise it for our office use.
During this little project I tried very hard to create an event that responds when an object is deleted, added or modified in the current document. I noticed in the VBA Editor that under ZWcad 2011 Professional Objects the ThisDocument object exists. In this class, if I choose zwcadDocument in the object bar I see in its right part the available events.
I created the following code in order to test:
----CODE: Start----
Private Sub ZwcadDocument_Activate()
'Does not work
Me.Utility.Prompt vbCrLf & "Activate" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectAdded(ByVal Entity As IIcadEntity)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Added" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectErased(ByVal ObjectID As Long)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Erased" & vbCrLf
End Sub
Private Sub ZwcadDocument_ObjectModified(ByVal Entity As IIcadEntity)
'Does not work
Me.Utility.Prompt vbCrLf & "Object Modified" & vbCrLf
End Sub
Private Sub ZwcadDocument_SelectionChanged()
'Works
Me.Utility.Prompt vbCrLf & "Selection changed" & vbCrLf
End Sub
----CODE: END----
From the above only the SelectionChanged event seems to work. Do I do something wrong? If not, why show these events if they don't work? I'm stumbled!



