Defines the number of columns and column attributes.
C
int WINAPI SftTree_GetColumnsEx(HWND hwndCtl, LPSFTTREE_COLUMN_EX* lpCols); BOOL WINAPI SftTree_SetColumnsEx(HWND hwndCtl, int count, LPCSFTTREE_COLUMN_EX lpCols); int WINAPI SftTreeSplit_GetColumnsEx(HWND hwndCtl, LPSFTTREE_COLUMN_EX *lpCols); BOOL WINAPI SftTreeSplit_SetColumnsEx(HWND hwndCtl, int count, LPCSFTTREE_COLUMN_EX lpCols);
C++
int CSftTree::GetColumns(LPSFTTREE_COLUMN_EX FAR * lpCols) const; BOOL CSftTree::SetColumns(int count, LPSFTTREE_COLUMN_EX lpCols); int CSftTreeSplit::GetColumns(LPSFTTREE_COLUMN_EX FAR * lpCols) const; BOOL CSftTreeSplit::SetColumns(int count, LPSFTTREE_COLUMN_EX lpCols);
hwndCtl
The window handle of the tree control.
count
The number of columns to be defined. A SFTTREE_COLUMN_EX entry must be defined for each column. This number may be 0, in which case a single, open-ended last column is defined (the lpCols parameter is ignored).
lpCols
SetColumns(Ex): A pointer to SFTTREE_COLUMN_EX structure(s), one for each column to be defined. This pointer may be NULL if count is 0, to define a single column. GetColumns(Ex): A pointer to an LPSFTTREE_COLUMN_EX variable, which is set on return to point to the column structures, one for each column defined. This pointer may be NULL, in which case only the number of columns is returned.
GetColumns returns the number of columns currently defined and sets a pointer to SFTTREE_COLUMN_EX structure(s).
SetColumns returns TRUE if the function was successful, FALSE otherwise.
The GetColumns(Ex) and SetColumns(Ex) functions define the number of columns and column attributes.
The pointer returned in parameter lpCols points to SFTTREE_COLUMN_EX structures, one for each column defined. The values in these structures may be modified (in-place) and updated using SetColumns.
The number of columns can only be modified if the tree control is empty.
To define the last column as open-ended use SetOpenEnded. An open-ended last column will display the complete text specified for the last (or only) column and never truncate any data. A fixed-width last column is defined with a specified width and any data which doesn't fit is truncated.
Due to the variable number of levels and the resulting hierarchical display, the width of the first column is always treated as a minimum width. The text portion of the first column will always be at least of the specified width, no matter what level the item is on. This can result in the first column being much wider than the defined width. See GetOverheadWidth for additional information.
An application should use RecalcHorizontalExtent or SetHorizontalExtent to recalculate or set the optimal horizontal scrolling extent.
Additional forms of the GetColumns(Ex)/SetColumns(Ex) functions exist, which use a SFTTREE_COLUMN structure, but are only provided for compatibility with earlier versions of SftTree/DLL and are not documented.
SftTree_GetCellInfo(hwndTree, &CellInfo);
Sft_GetPictureSize(&CellInfo.Cell.CellPicture1, &w, &h);
if (w <= PIC_SIZEX || h <= PIC_SIZEY) { // don't use images that are too large for the header
// copy it to row/column header and column header
SftTree_SetRowColHeaderPicture(hwndTree, &CellInfo.Cell.CellPicture1);/* Row/column picture */
nCols = SftTree_GetColumnsEx(hwndTree, &lpCol);/* Get column attributes */
Sft_CopyPicture(&lpCol[1].Picture1, &CellInfo.Cell.CellPicture1); // second column
SftTree_SetColumnsEx(hwndTree, nCols, lpCol); /* Set new column attributes */
} else {
SftTree_SetRowColHeaderPicture(hwndTree, NULL);
nCols = SftTree_GetColumnsEx(hwndTree, &lpCol);/* Get column attributes */
Sft_ClearPicture(&lpCol[1].Picture1); // second column
m_Tree.GetCellInfo(&CellInfo);
Sft_GetPictureSize(&CellInfo.Cell.CellPicture1, &w, &h);
if (w <= PIC_SIZEX || h <= PIC_SIZEY) { // don't use images that are too large for the header
// copy it to row/column header and column header
m_Tree.SetRowColHeaderPicture(&CellInfo.Cell.CellPicture1);/* Row/column picture */
nCols = m_Tree.GetColumns(&lpCol);/* Get column attributes */
Sft_CopyPicture(&lpCol[1].Picture1, &CellInfo.Cell.CellPicture1); // second column
m_Tree.SetColumns(nCols, lpCol); /* Set new column attributes */
} else {
m_Tree.SetRowColHeaderPicture(NULL);
nCols = m_Tree.GetColumns(&lpCol);/* Get column attributes */
Sft_ClearPicture(&lpCol[1].Picture1); // second columnSee Also C/C++ API | Categories | Notifications