The control fires the HostEvent(Ev) event as soon as the inner control fires an event. The Ev parameter of the HostEvent event holds all
information about the event such as name, identifier and all its arguments. The AsString
property of the Ev object (NETHostEvent type) gives a brief description of the event including its arguments such as
"MouseMove[72] {Button = Left, Clicks = 0, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}", where MouseMove is the name of the event (Name
property), 72 is the event's identifier (ID property), and arguments separated by comma between {} characters as follow:
Button argument with the value "Left", Clicks argument with the value of 0, X argument with the value 69, Y parameter with the value of 53, Delta argument with the value of 0 and Location parameter as an object/structure with two fields X and Y.
The following sample displays brief information about firing events:
Private Sub NETHost1_HostEvent(ByVal Ev As exontrol_NETHostCtl.INETHostEvent)
With NETHost1
Debug.Print Ev.AsString()
End With
End Sub
and the output may look as follows:
MouseMove[72] {Button = Left, Clicks = 0, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}
NodeMouseHover[15] {Node = TreeNode: Sub-Child 2.1}
Click[42] {Button = Left, Clicks = 1, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}
For instance, let's say we need to handle the MouseMove event of the System.Windows.Forms.TreeView inner control, so we need a handler as follows:
Private Sub NETHost1_HostEvent(ByVal Ev As exontrol_NETHostCtl.INETHostEvent)
With Ev
If (.Name = "MouseMove") Then
With .Arguments
Debug.Print "Button", .Item("Button").AsInt
Debug.Print "Clicks", .Item("Clicks").AsInt
Debug.Print "X", .Item("X").AsInt
Debug.Print "Y", .Item("Y").AsInt
Debug.Print "Delta", .Item("Delta").AsInt
Debug.Print "Location.X", .Item("Location.X").AsInt
Debug.Print "Location.Y", .Item("Location.Y").AsInt
End With
End If
End With
End Sub