Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

CaretColumn

Returns the column where a mouse button was last clicked.

C

int WINAPI SftTree_GetCaretColumn(HWND hwndCtl);
int WINAPI SftTreeSplit_GetCaretColumn(HWND hwndCtl);

C++

int CSftTree::GetCaretColumn() const;
int CSftTreeSplit::GetCaretColumn() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

The return value is the zero-based column number where a mouse button was last clicked. The return value is -1 if the mouse button has been clicked outside of a column.

Comments

The GetCaretColumn function returns the column where a mouse button was last clicked.

As a tree control, SftTree/DLL does not support cell selection, only item selection is possible using SetCaretIndex. Consequently, a "SetCaretColumn" function is not available.

Examples

C

                }
                break;
              }
            case SFTTREEN_LBUTTONDOWN_TEXT: {
                /* Edit the current cell */
                /* Get cell to edit (honors cell merging) */
                int index, col;
                index = SftTree_GetCaretIndex(g_hwndTree);/* Get item index */
                col = SftTree_GetCaretColumn(g_hwndTree);/* Get column number */
                StartEdit(index, col);
                break;
             }
            case SFTTREEN_QUITEDIT:
                /* Abandon editing */
                QuitEdit();
                break;

C++

/* These routines handle item data editing. In this        */
/* example, an edit control is used. Any Windows control   */
/* can be used, even custom controls.                      */

void CSampleView::OnLButtonDownText()
{
    int index, col;
    index = m_Tree.GetCaretIndex();/* Get item index */
    col = m_Tree.GetCaretColumn();/* Get column number */
    StartEdit(index, col);
}

/* Start editing in response to a                          */
/* SFTTREEN_LBUTTONDOWN_TEXT notification.                 */

void CSampleView::StartEdit(int index, int col)

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