I fixed the RootHasCheckbox problem in ucWndProc -> TVN_ITEMCHANGINGW
Before:
After:Code:Case TVN_ITEMCHANGINGW If (bFilling = False) And (g_fDeleting = False) And (mAutocheck = True) Then ..... End If
New code for property ShowOnlyFileCheckbox:Code:Case TVN_ITEMCHANGINGW If (bFilling = False) And (g_fDeleting = False) And (mAutocheck = True) Then ..... ElseIf (bFilling = False) And (g_fDeleting = False) Then 'MITH Call CopyMemory(nmtvic, ByVal lParam, LenB(nmtvic)) tvix.Mask = TVIF_STATEEX tvix.hItem = nmtvic.hItem Call SendMessage(hTVDW, TVM_GETITEM, 0, tvix) If (nmtvic.hItem = m_hRoot) And (mRootHasCheckbox = False) Then lReturn = 1 bHandled = True Exit Sub End If idx = GetTVItemlParam(hTVD, nmtvic.hItem) tNew = TVEntries(idx) If (tNew.bFolder = True And mShowOnlyFileCheckbox = True And mShowFiles = True) Then lReturn = 1 bHandled = True Exit Sub End If End If
Code:Private mShowOnlyFileCheckbox As Boolean Private Const mShowOnlyFileCheckbox_def As Boolean = False Public Property Get ShowOnlyFileCheckbox() As Boolean: ShowOnlyFileCheckbox = mShowOnlyFileCheckbox: End Property Public Property Let ShowOnlyFileCheckbox(bVal As Boolean) mShowOnlyFileCheckbox = bVal End Property Private Sub UserControl_ReadProperties(propBag As PropertyBag) mShowOnlyFileCheckbox = propBag.ReadProperty("ShowOnlyFileCheckbox", mShowOnlyFileCheckbox_def) End Sub Private Sub UserControl_WriteProperties(propBag As PropertyBag) propBag.WriteProperty "ShowOnlyFileCheckbox", mShowOnlyFileCheckbox, mShowOnlyFileCheckbox_def End Sub Private Sub UserControl_InitProperties() mShowOnlyFileCheckbox = mShowOnlyFileCheckbox_def End SubCode:Private Sub TVExpandFolder(lParam As Long, hitemParent As Long) ..... If bFav Or (bFolder = True And mShowOnlyFileCheckbox = True And mShowFiles = True) Then 'Mith TreeView_SetCheckStateEx hTVD, hitemPrev, 0 Else If TreeView_GetCheckState(hTVD, hitemParent) = 2 Then If mAutocheck = True Then TreeView_SetCheckState hTVD, hitemPrev, 1 End If End If End If ..... End Sub




Reply With Quote
