Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to prevent a individual node to be checked / uncheck
Message
 
À
10/01/2006 08:33:02
Arlei Silva
Chevron Oronite Brasil Ltda.
Capuava, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01085145
Message ID:
01085253
Vues:
16
Arlei,

What I've done is something like this (Not sure if it is exactly what you want):

In the NodeCheck event of the treeview:
lparameters loNode

thisform.CheckChilds(loNode)
thisform.CheckParent(loNode)
CheckChilds method:
* Auto checks all of the node childs.
* This means that if a department is checked, 
* all employess of the department will be checked also

lparameters loNode
local loChild

if isnull(loNode)
	return
endif
loChild=loNode.Child
do while not isnull(loChild)
	loChild.Checked=loNode.Checked
	thisform.CheckChilds(loChild)
	loChild=loChild.next
enddo
CheckParent method:
* This method verifies if a node has all its children checked.
* If this is the case, then it checks it and verifies its parent.
* Otherwise it unchecks it if applicable

lparameters loNode
local loParent, llChecked, loChild

loParent=loNode.parent
if not isnull(loParent)
	loChild=loParent.Child
	llChecked=.t.
	do while not isnull(loChild) and llChecked
		llChecked=loChild.Checked
		loChild=loChild.Next
	enddo
	loParent.Checked=llChecked
	thisform.CheckParent(loParent)
endif
So, using this I accomplish the following:
- If I check a node, all its children (and its children) will be checked
- If I uncheck a node, it's parent is also unchecked, and it's parent parent, for not all it's children are checked now
- If I check a node, and this means that all it's parent nodes are checked, then I also check the parent
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform