View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jurry[_15_] Jurry[_15_] is offline
external usenet poster
 
Posts: 1
Default Problems with preventing the user of setting a checkbox of a treeview

After searching on the net I found the following workaround for this BU
in VB: you have the use the event MouseUp. This event takes alway
place after the clicking of a node by the user (and therefore AFTER th
NodeCheck event). In combination with a global var the result is:

In a standard module:

Code
-------------------
Public gnodNodeWithCheckboxToBeProcessed As MSComctlLib.Nod
-------------------

In the treeview dialog module:

Code
-------------------
Private Sub treeSpotsOverview_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
' used to work around the bug in VB to alter the checkbox state during the
' nodecheck event
If Not gnodNodeWithCheckboxToBeProcessed Is Nothing Then
gupvlPlateValues.HandleTreeCheckboxChange gnodNodeWithCheckboxToBeProcessed
Set gnodNodeWithCheckboxToBeProcessed = Nothing
End If
End Sub

Private Sub treeSpotsOverview_NodeCheck(ByVal Node As MSComctlLib.Node)
' Actual action in the mouseup event due to bug of VB
Set gnodNodeWithCheckboxToBeProcessed = treeSpotsOverview.Nodes(Node.Index)
End Su
-------------------


Have fun with it,
Jurry

--
Message posted from http://www.ExcelForum.com