Getter for SelectedNodeIsBold is incorrect

Summary

Id: 5293.1
Type: Bug Bug
Current Status: Resolution Identified

Detail

16 Nov 2003 Resolution Identified Arnout de Vries

I used a part of your code for manipulating the TreeView from the Common Controls 5. Because of XP themes I don't use the Common Controls 6 OCX that comes with VB6. I had to modify this part to get it working:

Public Property Get SelectedNodeIsBold() As Boolean
Attribute SelectedNodeIsBold.VB_Description = "Gets/sets whether the selected
 item should be shown in bold font."
Dim tVI As TVITEM
Dim hItem As Long
    hItem = SendMessageLong(tvwOpt.hwnd, TVM_GETNEXTITEM, TVGN_CARET, 0&)
    If hItem <> 0 Then
        With tVI
            .hItem = hItem
            .mask = TVIF_STATE
            .stateMask = TVIS_BOLD
            SendMessage tvwOpt.hwnd, TVM_GETITEM, 0&, tVI
            'SelectedNodeIsBold = (tVI.state = TVIS_BOLD)
            ' I think it needs to be
            SelectedNodeIsBold = ((tVI.state And TVIS_BOLD) = TVIS_BOLD)
        End With
    End If
End Property

Arnout de Vries

AdWare Media Solutions