Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preventing user input for individual cells Michael.Tarnowski Excel Worksheet Functions 3 January 30th 09 12:05 AM
Clear a Checkbox in a a user form Cerberus Excel Discussion (Misc queries) 6 June 26th 08 10:41 PM
Preventing an excel file from being deleted by another user pmcgr0arty Excel Discussion (Misc queries) 2 March 15th 06 11:56 PM
Preventing a user name in comments Gabriel Excel Discussion (Misc queries) 1 January 15th 06 11:10 AM
Preventing user entering duplicate values in a cell range Thomas Peters Excel Worksheet Functions 1 November 30th 05 08:00 PM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"