Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems with preventing the user of setting a checkbox of a treeview
I want to prevent that users select certain checkboxes of a treeview.
tried doing that by placing a routine in the NodeCheck event of th treeview. During debuging I see the checkbox being set back to my ow value, but after the whole event the checkbox has the users value! S in short the following code does not work, why not? Private Sub treeSpotsOverview_NodeCheck(ByVal Node As MSComctlLib.Node tree.Nodes(Node.index).Checked = True End Sub Thanks, Jurry. PS: I'm using VBA -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Preventing user input for individual cells | Excel Worksheet Functions | |||
Clear a Checkbox in a a user form | Excel Discussion (Misc queries) | |||
Preventing an excel file from being deleted by another user | Excel Discussion (Misc queries) | |||
Preventing a user name in comments | Excel Discussion (Misc queries) | |||
Preventing user entering duplicate values in a cell range | Excel Worksheet Functions |