LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree Image Problem

Hi!!

What is it wrong with this code? The image does not appear when the tree list is displayed.

    int m_intItemIndex;
    
    if ( !g_intTreeIndex ) {
        int m_intBmFolder;
        GetBitmapFromFile ("c:\\gdt\\HorusDS\\icons\\dataSourceList\\closedfoldericon.ico", &m_intBmFolder);
        g_intIndexOpen    =    AddTreeImage (p_intDSPanelHandle, p_intDSControlHandle, m_intBmFolder); // Adds an image of open folder to the tree control.
        DiscardBitmap (m_intBmFolder);
    }
    
    m_intItemIndex    =    InsertTreeItem(p_intDSPanelHandle, p_intDSControlHandle, VAL_SIBLING, 0, VAL_LAST,
        p_chrBufferProviderList, NULL, NULL, g_intTreeIndex);
    SetTreeItemAttribute(p_intDSPanelHandle, p_intDSControlHandle, m_intItemIndex, ATTR_MARK_TYPE, VAL_MARK_NONE);

    SetTreeItemAttribute (p_intDSPanelHandle, p_intDSControlHandle, m_intItemIndex, ATTR_IMAGE_INDEX, g_intIndexOpen);
    SetTreeItemAttribute (p_intDSPanelHandle, p_intDSControlHandle, m_intItemIndex, ATTR_COLLAPSED_IMAGE_INDEX, g_intIndexOpen);

Thank you in advance!
0 Kudos
Message 1 of 3
(3,184 Views)

You need to tell the tree control that you want it to make room for the images. You can do this in the UI editor (in the Advanced Tree Options dialog) or programmatically like this:

SetCtrlAttribute(panelHandle, PANEL_TREE, ATTR_SHOW_IMAGES, 1);

0 Kudos
Message 2 of 3
(3,172 Views)
It works!

But now, I am in doubt to do another thing. I only want to show the images next to the items that have some children.

As you could see I know the item index that I want to show the image (the item can be collapsed or not).

Thank you


0 Kudos
Message 3 of 3
(3,154 Views)