World Map


Author
Message
Bruce Guthrie
Bruce Guthrie
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 2

Hello,

I like the world maps and the one thing i would like to find out is, is it possible to add a mouse click event so that when the user clicks on a country the name or any other information can be captured for futher use.

there is already the interactivity tool and i tried to add the mouse event click event but was unable to come up with the correct code.

could you post the code in vb.net.

Regards

Bruce.


Reply
Pavel Vladov
Pavel Vladov
Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)
Group: Forum Members
Posts: 33, Visits: 2
Hi Bruce,
in the mouse up event use the following code:
    Private Sub EventSinkService_NodeMouseUp(ByVal args As NNodeMouseEventArgs)
If args.Button = MouseButtons.Left Then
Dim viewCoordinates As PointF = New PointF(args.X, args.Y)
Dim sceneCoordinates As PointF = worldmap1.SceneToWorld.InvertPoint(viewCoordinates)
Dim node As INNode = args.Node

While (node IsNot Nothing) And (TypeOf node Is NShape = False)
node = node.ParentNode
End While

If node Is Nothing Then Exit Sub

Dim shape As NShape = TryCast(node, NShape)

'Dim shape As NShape = TryCast(args.Node, INDiagramElement)

MessageBox.Show(String.Format("Shape Name: '{0}', Type: '{1}'", shape.Name, CType(shape.ParentNode, NLayer).Name))

' mark as handled and processed to stop bubbling and processing
args.Handled = True
End If
End Sub

Note how we take the type of the shape - we just look for the layer the shape is placed in. The layer of the shape is its parent node.

I hope this helps.

Best Regards,
Pavel Vladov
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search