BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Attached is my code. When I click on a checkbox it will go to the alternate checkstate but then go back to the original. If I double click the checkbox (I have no code in the
TreeViewAdv2_NodeMouseDoubleClick it will stay at the correct checkstate. If I put a breakpoint in my code or have something such as a msgbox command it will staty at the correct checkstate, however without any of these in place it will go back to the original checkstate.
What I want to accomplish if the users left clicks on the checkbox or the node text I want the node text to change (which it does correctly) but then alternate the checkstate from what it was (ie. if checked, then uncheck and vice-versa).
It's a very strange issue. I am running the latest controls.
Code:
Private Sub TreeViewAdv2_NodeMouseClick(sender As Object, e As TreeViewAdvMouseClickEventArgs) Handles TreeViewAdv2.NodeMouseClick
' Check for right-click to show Properties menu
Dim selectedNode As TreeNodeAdv = e.Node
If e.Mousebutton = MouseButtons.Right Then
TreeViewAdv2.SelectedNode = selectedNode
' Display Properties menu based on node type
If selectedNode.Parent IsNot Nothing AndAlso selectedNode.Parent.Text <> "root" AndAlso selectedNode.Parent.Text <> "Code" Then
contextMenu.Items("Properties").Enabled = True
Else
contextMenu.Items("Properties").Enabled = False
End If
' Show the context menu at the mouse position
contextMenu.Show(MousePosition)
Else
'Dim selectedNode As TreeNodeAdv = e.Node
Dim nodeInfo As tagData = TryCast(selectedNode.Tag, tagData)
TreeViewAdv2.SelectedNode = selectedNode
' Update node text based on the intended checked state
Try
If Not selectedNode.Checked Then
' Node is being checked, update to newData
If nodeInfo IsNot Nothing AndAlso Not String.IsNullOrEmpty(nodeInfo.newData) Then
selectedNode.Text = nodeInfo.newData
End If
selectedNode.CheckState = CheckState.Checked
Else
' Node is being unchecked, revert to previousData
If nodeInfo IsNot Nothing AndAlso Not String.IsNullOrEmpty(nodeInfo.previousData) Then
selectedNode.Text = nodeInfo.previousData
End If
selectedNode.CheckState = CheckState.Unchecked
End If
Catch ex As Exception
LogError($"Error handling BeforeCheck state change: {ex.Message}")
End Try
End If
End Sub
Hi Jeff,
We are currently analyzing your reported scenario. We need more time to validate the scenario, we will provide an update on or before November 04, 2024.
Regards,
Madhavan S
Were you able to look into this?
Hi Jeff,
We are currently preparing a workaround for your requirement. We still need more time to achieve this, and we will provide you further details by November 06, 2024.
Regards,
Manikanda Akash
Dim isMouseOverCheckBox = selectedNode.CheckBox.Bounds.Contains(TreeViewAdv1.PointToClient(Cursor.Position)) If Not selectedNode.Checked Then If nodeInfo IsNot Nothing AndAlso Not String.IsNullOrEmpty(nodeInfo.newData) Then selectedNode.Text = nodeInfo.newData End If If Not isMouseOverCheckBox Then selectedNode.CheckState = CheckState.Checked End If Else If nodeInfo IsNot Nothing AndAlso Not String.IsNullOrEmpty(nodeInfo.previousData) Then selectedNode.Text = nodeInfo.previousData End If If Not isMouseOverCheckBox Then selectedNode.CheckState = CheckState.Unchecked End If End If |
Attachment: TreeViewAdv_VB_55ceaad7.zip
Thank you! Works great!
Hi Jeff,
We're
glad to hear that the approach we suggested worked well for you. Hence, we’ll be closing the
forum.
Regards,
Manikanda Akash