winforms - .Net Treeview Event Handling -


I am in the process of migrating VB6 apps to .NET and we must provide the same identical functionality at all times. There is a check view in a form where there are three levels of nodes. The first level works only for groups of the next level and they are not investigative. Second level nodes are checked by the user and when all checks are made or unchecked, all the children follow the suit. At all levels, clicking on the node or its checkbox means to select it, even if the check status is affected or not.

The problem of the third level is the problem (although this issue appears on itself, all treeview check boxes): This level is the 'type' of the two nodes, one that can be checked by the user and unchecked (If parents were checked) and there is a type which can not be checked by the user of the state without being uncontrolled, parents, but its position is the mirror of his parents.

In normal use it does all the work as expected; However, if you quickly click on one of the third level nodes (which is not considered directly investigative), its probe status It seems to change. But if you check the underlying value of the checked property, then it remains unaffected, so it seems that this is a demonstration issue. If it has come to know that this discrepancy will be an issue for our customers because users think they can do something that they can not afford in the event of expensive confusion.

I am fresh with thoughts on this - has anyone seen it Behavior or know about it and what are its solutions / solutions? I can not help feeling that something is really visible to me but after one and a half days I am now seeing the tunnel vision. To demonstrate the problem, here is some code, create a form with the previewview (see what's going on is enough to see it) and drop it after two buttons:

The form of private _node the TreeNode = some handles not

  private sub-button L_kik ByVal sender as System.Object, ByVal e System.EventArgs as) Button1.Click MessageBox.Show (_node.Text & amp Is, ":" & amp; _node.Checked.ToString) _node = None End Sub Personal Sub InitialiseTreeview () TreeView1 NodeskClear () Dim new random random () As part of the I Int32 as = 1 5 as children as retarded new TreeNode to dim TLNode Int32 = 0 = ran.Next children (1, 5) TLNode.Text = "top level node" & Amp; Next TreeView1.Nodes.Add (TLNode) Next TreeView1.ExpandAll () End Sub as TLNode.Nodes.Add (j.ToString "child node" & amp) Private Sub Form1_Load (ByVal sender; j Int32 = 1 children as i.ToString object, as ByVal e System.EventArgs) handles Me.Load InitialiseTreeview () End sub Private sub Button2_Click (ByVal in this SystemkObject, as ByVal e System.EventArgs) handle Button2.Click InitialiseTreeview () End Sub  

to run it, click on a node button on one and it will tell you the node text and check. Now click on the same nodes checkbox twice, inspect the status of fast, checkmark, and then click on the 1 button. You will see what I mean button 2 generates a new set of tree nodes.

Yes, this is a vista version of the native TreeView control when it sees double-clicked events Automatically toggle the check status of the item. Without informing this about the .NET TreeView wrapper, the first / next check event will not run. It has not been fixed in the .NET wrapper and probably will never happen.

To work around this bug, it is necessary to stop the original control from seeing the double-click message. Add a new class to your project and paste the code shown below. The new control drop above the toolbox on your form, replacing the existing TreeView.

  Public Class MyTreeView inherited TreeView protected override sub WndProc (M System.Windows.Forms.Message Form ByRef) '' WM_LBUTTONDBLCLK Filter messages if m.Msg & lt; & Gt; & Amp; H203 then MyBase.WndProc (m) end sub end class  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -