Notifications
Clear all

[Closed] How can I change the behavior of doublleclick in dotnet treeview?

When a treeview node has children, doubleclicking expands the node.
I want to change this to LabelEdit.

any ideas?

2 Replies
(
	try destroydialog ::RO_TREEVIEW_TEST catch()
	rollout RO_TREEVIEW_TEST "" width:144 height:272
	(
		dotnetcontrol dnc_treeview "Treeview" pos:[8,8] width:128 height:256
		
		local doubleClick = false
		
		on RO_TREEVIEW_TEST open do
		(
			n1 = dotnetobject "TreeNode"
			n1.Text = "Main 1"
			
			n2 = dotnetobject "TreeNode"
			n2.Text = "Main 2"
			
			for j = 1 to 3 do
			(
				n = dotnetobject "TreeNode"
				n.Text = "Node " + (j as string)
				n1.Nodes.Add n
				
				n = dotnetobject "TreeNode"
				n.Text = "Node " + (j as string)
				n2.Nodes.Add n
			)
			
			dnc_treeview.Nodes.Add n1
			dnc_treeview.Nodes.Add n2
			dnc_treeview.LabelEdit = true
		)
		
		on dnc_treeview NodeMouseDoubleClick args do
		(
			if (args.Button == args.Button.Left) do args.node.BeginEdit()
		)
		
		on dnc_treeview MouseDown args do doubleClick = args.Clicks > 1
		
		on dnc_treeview BeforeExpand args do args.Cancel = doubleClick
		
		on dnc_treeview BeforeCollapse args do args.Cancel = doubleClick
	)
	
	createdialog RO_TREEVIEW_TEST
)

Thanks!