June 26th, 2013, 09:12 AM
[RESOLVED] Checkbox enabled Treeview Bug - workaround !!
So i'm using a treeview with checkbox's enabled, and via some customization I'm only enabling the checkbox's on the root nodes (see attached pic), which was actually not too difficult, and not the issue here..
There is a serious bug in the Checkbox Double Click.. Dbl Clicking on the Checkbox itself and not the node text, presents some interesting issues. I've done many hours of coding and recoding and trapping, and this is what i have worked out so far..
The double Clicking on the Checkbox acts very much like a Dbl click hold... Ie. Click, Release, Click, Hold.. A third Click on the checkbox does the final release of the Dbl click... NOW.. this bug has been reported to MS earlier this year ... (MS connect thread here) and MS has simply shrugged it off with a
IE... we just not interested in fixing this BUG, and go find a workaround...
Thank you for reporting this issue. -- We have evaluated the issue that you have reported and at this point in the product's lifecycle, it does not meet the criteria to be addressed.
After some searching.. i found this thread with a workaround.. Ohhhhh shucks it's in C again...
So here's the VB.NET equivalent....
Now what i did was add a new project to the solution called 'MyTreeView', with just the single class (you may need to add the System.Windows.Forms .NET reference to the project.)
Public Class MyTreeView
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = &H203 Then
Dim LocalPos = PointToClient(Cursor.Position)
Dim hitTestInfo = HitTest(LocalPos)
If (hitTestInfo.Location = TreeViewHitTestLocations.StateImage) Then
m.Result = 0
Compiled the project, then added the 'MyTreeView' project as a reference to the project where i needed the treeview, then simply used Mytreeview.mytreeview instead of system.windows.forms.treeview object..
This effectively completely disables Dbl clicking on the treeview checkbox, but dbl clicking on the node will expand and collapse the nodes..
Friend WithEvents TVModules As MyTreeView.MyTreeView
Me.TVModules = New MyTreeView.MyTreeView
Me.TVModules.CheckBoxes = True
Me.TVModules.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll
Me.TVModules.Location = New System.Drawing.Point(81, 32)
Me.TVModules.Name = "TVModules"
Me.TVModules.ShowNodeToolTips = True
Me.TVModules.Size = New System.Drawing.Size(575, 199)
Me.TVModules.TabIndex = 54
I hope someone else gets some joy, and relief with this...
Last edited by GremlinSA; June 26th, 2013 at 09:26 AM.
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
June 27th, 2013, 04:15 AM
Re: [RESOLVED] Checkbox enabled Treeview Bug - workaround !!
Nice post! Thanks for sharing the workaround
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!