Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

CellInfo

Defines a cell's attributes.

C

BOOL WINAPI SftTree_GetCellInfo(HWND hwndCtl, LPSFTTREE_CELLINFOPARM lpCellParm);
BOOL WINAPI SftTree_SetCellInfo(HWND hwndCtl, LPCSFTTREE_CELLINFOPARM lpCellParm);
BOOL WINAPI SftTreeSplit_GetCellInfo(HWND hwndCtl, LPSFTTREE_CELLINFOPARM lpCellParm);
BOOL WINAPI SftTreeSplit_SetCellInfo(HWND hwndCtl, LPCSFTTREE_CELLINFOPARM lpCellParm);

C++

BOOL CSftTree::GetCellInfo(LPSFTTREE_CELLINFOPARM lpCellParm) const;
BOOL CSftTree::SetCellInfo(LPCSFTTREE_CELLINFOPARM lpCellParm);
BOOL CSftTreeSplit::GetCellInfo(LPSFTTREE_CELLINFOPARM lpCellParm) const;
BOOL CSftTreeSplit::SetCellInfo(LPCSFTTREE_CELLINFOPARM lpCellParm);

Parameters

hwndCtl

The window handle of the tree control.

lpCellParm

A pointer to a SFTTREE_CELLINFOPARM structure which holds the required parameters.

Returns

The return value is TRUE if the function is successful, otherwise FALSE is returned.

Comments

The GetCellInfo and SetCellInfo functions define a cell's attributes.

To modify a cell's attributes, the GetCellInfo function is used to retrieve its current attributes. The SFTTREE_CELL structure, part of the SFTTREE_CELLINFOPARM structure, can then be modified, setting the desired attributes. Finally, the cell is updated by a call to the SetCellInfo function.

Cell text can be retrieved using GetText and modified using SetText.

In a fixed height tree control, all cell pictures used for all cells must be the same size. In a variable height tree control, cell pictures can be of varying sizes. The (largest) cell picture size must be registered using SetCellInfo.

A cell may have an associated cell picture without the picture actually being visible. The cell picture doesn't become visible until the cell picture size has been registered using SetCellInfo by setting the index member of the SFTTREE_CELLINFOPARM structure to -1. Only one picture is used to register the picture size. After registering the picture size, any number of pictures may be used. A new picture size can be registered at any time, but in a fixed height tree control, all cell pictures in use must be replaced by pictures of the new size.

Pictures are owned by the application and the associated bitmap, icon or ImageList handles have to remain valid as long as the tree control uses them. Handles have to be deleted by the application once they are no longer needed.

Fonts are owned by the application and the associated font handles have to remain valid as long as the tree control uses them. Fonts have to be deleted using DeleteObject once they are no longer needed.

In a tree control using a virtual data source, SetCellInfo can only be used to register the cell picture size. Cell attributes cannot be modified.

Examples

C

#define PIC_SIZEY_SORT           8      /* Height of sort direction indicator */

/**********************************************************************/
/*                         Helper Routines                            */
/**********************************************************************/

static void SetCellPicture(HWND hwndTree, int index, SFT_PICTURE* pPic, int align)
{
    SFTTREE_CELLINFOPARM CellInfo;
    CellInfo.version = 7;
    CellInfo.index = index;
    CellInfo.iCol = 0;
    SftTree_GetCellInfo(hwndTree, &CellInfo);
    Sft_ClearPicture(&CellInfo.Cell.CellPicture1);
    Sft_CopyPicture(&CellInfo.Cell.CellPicture1, pPic);
    CellInfo.Cell.flag = align;

C++

#endif //_DEBUG

/**********************************************************************/
/*                         Helper Routines                            */
/**********************************************************************/

void CSampleView::SetCellPicture(int index, SFT_PICTURE* pPic, int align)
{
    SFTTREE_CELLINFOPARM CellInfo;
    CellInfo.version = 7;         
    CellInfo.index = index;
    CellInfo.iCol = 0;
    m_Tree.GetCellInfo(&CellInfo);
    Sft_ClearPicture(&CellInfo.Cell.CellPicture1);
    Sft_CopyPicture(&CellInfo.Cell.CellPicture1, pPic);
    CellInfo.Cell.flag = align;

See Also C/C++ API | Categories | Notifications