Use Native Trackselect in TreeView and ListView

Use Native Trackselect in TreeView and ListView

You can make your TreeView or ListView control behave like a menu so that as you move the mouse cursor over the items, the highlighted item moves with the cursor. Use this code in the TreeView or ListView’s MouseMove event:

 Private Sub TreeView1_MouseMove(Button _	As Integer, Shift As Integer, x As _	Single, y As Single)	Dim AnyNode As Node	' HitTest returns a node object 	' under the cursor	Set AnyNode = TreeView1.HitTest(x, _		y)	If Not AnyNode Is Nothing Then		Set TreeView1.DropHighlight = _			AnyNode		TreeView1.DropHighlight. _			Selected = True	End IfEnd SubPrivate Sub ListView1_MouseMove(Button _	As Integer, Shift As Integer, x As _	Single, y As Single)	Dim AnyItem As ListItem	'HitTest returns a node object under 	'the cursor	Set AnyItem = ListView1.HitTest(x, _		y)	If Not AnyItem Is Nothing Then		Set ListView1.DropHighlight = _			AnyItem		ListView1.DropHighlight. _			Selected = True	End IfEnd Sub
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular