Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Override the multi-state checkbox functionality in FolderView

 
Subscribe to the RSS feed for this forum  Forum Index -> FolderView ActiveX Control
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Thu Sep 04, 2008 4:09 am    Post subject: HOWTO: Override the multi-state checkbox functionality in FolderView

FolderView shows multi-state checkboxes where the check-state of a node depends not only on whether the node itself is checked or unchecked but also on whether the node' children are checked or unchecked. The default multi-state functionality in FolderView can be overridden to show any desired check-state for any combination of checked/unchecked children and the node itself. This is done using the OnQueryNodeCheckState event as follows :

[C++]
void CFdrViewVCDlg::OnOnQueryNodeCheckStateFolderviewctrl1(LPDISPATCH Node)
{
// Query the combined check-state of all children,
// If it is 'FOVSomeChecked', meaning some but not all children are checked,
// set the checkstate of the node to Checked.
// Default implementation shows a filled checkbox with no check mark indicating
// that some of the node's children are checked but the node itself is not checked
// This code overrides that

CTreeNode node;
node.AttachDispatch(Node,FALSE);
if(node.GetChildrenCheckState()== 2) //FOVChildrenCheckState.FOVSomeChecked = 2
node.SetCheckState(2); // CheckStates.Checked = 2
}


[VB6]
Private Sub FolderView1_OnQueryNodeCheckState(ByVal Node As FolderViewControl.ITreeNode)

' Query the combined check-state of all children,
' If it is 'FOVSomeChecked', meaning some but not all children are checked,
' set the checkstate of the node to Checked.
' Default implementation shows a filled checkbox with no check mark indicating
' that some of the node's children are checked but the node itself is not checked
' This code overrides that

If Node.GetChildrenCheckState = FOVSomeChecked Then
Node.CheckState = CheckStates.Checked
End If

End Sub
Back to top
Display posts from previous:   
Forum Index -> FolderView ActiveX Control All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group