Automation Events
- Last UpdatedJul 13, 2023
- 1 minute read
The graphics builder also provides event-based notification of actions, which an Automation client can intercept and react to accordingly. The following example creates a form, creates a graphics builder automation object with event capability and performs actions on two events that the graphics builder might generate, pasting a symbol and saving a page.
To enable this:
-
The Graphics Builder object needs to be declared "WithEvents"
-
The event handler subroutine needs to have the correct name and signature. Note how the event handler function names are gb, the graphics builder object, followed by _<eventName> e.g gb_PasteSymbol. This is consistent with standard Visual Basic event handling subroutine naming.
For details, see the individual event subroutine description.
Private WithEvents gb As GraphicsBuilder.GraphicsBuilder
Public Sub Form_Load()
Set gb = New GraphicsBuilder.GraphicsBuilder
gb.LibrarySelectionHooksEnabled = True
gb.Visible = True
End Sub
Public Sub gb_PasteSymbol()
MsgBox ("PasteSymbol")
End Sub
Private Sub gb_PageSaved(ByVal Project As String, ByVal Page As String,
ByVal LastPage As Boolean)
MsgBox "PageSaved: " + Project + "." + Page + "--"
End Sub