Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DragType

Defines the drag & drop detection attribute.

C

int WINAPI SftTree_GetDragType(HWND hwndCtl);
void WINAPI SftTree_SetDragType(HWND hwndCtl, int dragType);
int WINAPI SftTreeSplit_GetDragType(HWND hwndCtl);
void WINAPI SftTreeSplit_SetDragType(HWND hwndCtl, int dragType);

C++

int CSftTree::GetDragType() const;
void CSftTree::SetDragType(int dragType);
int CSftTreeSplit::GetDragType() const;
void CSftTreeSplit::SetDragType(int dragType);

Parameters

hwndCtl

The window handle of the tree control.

dragType

A value describing the drag & drop detection method used:

SFTTREE_DRAG_LEAVEThe drag & drop operation can start from a cell and is initiated once the mouse cursor leaves the current item. Before an item can be dragged, it has to be selected using the keyboard or the mouse button and the mouse button has to be released, then a drag & drop operation can be started by pressing the mouse button again.
SFTTREE_DRAG_LEAVEIMMThe drag & drop operation can start from a cell and is initiated once the mouse cursor leaves the current item. An item can be dragged as it is selected in a single selection tree control (see SFTTREESTYLE_MULTIPLESEL). In a multiple-selection tree, an item has to be selected before it can be dragged (identical to SFTTREE_DRAG_LEAVE).
SFTTREE_DRAG_LEAVEIMM2The drag & drop operation can start from a cell and is initiated once the mouse cursor leaves the current item. An item can be dragged as it is selected in both a single and multiple selection tree control (see SFTTREESTYLE_MULTIPLESEL).
SFTTREE_DRAG_PIXELThe drag & drop operation can start from a cell and is initiated once the mouse cursor is moved by a certain pixel distance. Before an item can be dragged, it has to be selected using the keyboard or the mouse button and the mouse button has to be released, then a drag & drop operation can be started by pressing the mouse button again.
SFTTREE_DRAG_PIXELIMMThe drag & drop operation can start from a cell and is initiated once the mouse cursor is moved by a certain pixel distance. An item can be dragged as it is selected in a single selection tree control (see SFTTREESTYLE_MULTIPLESEL). In a multiple-selection tree, an item has to be selected before it can be dragged (identical to SFTTREE_DRAG_PIXEL).
SFTTREE_DRAG_PIXELIMM2The drag & drop operation can start from a cell and is initiated once the mouse cursor is moved by a certain pixel distance. An item can be dragged as it is selected in both a single and multiple selection tree control (see SFTTREESTYLE_MULTIPLESEL).

Returns

GetDragType returns a value indicating the current drag & drop detection method used.

Comments

The GetDragType and SetDragType functions define the drag & drop detection attribute.

A tree control must be defined using the SFTTREESTYLE_DRAGDROP window style to support drag & drop.

SetDragType determines when the SFTTREEN_BEGINDRAG notification is generated to notify the application that a drag & drop operation has been initiated by the user.

A drag & drop operation always starts at the current location described by GetCaretIndex. It is the application's responsibility to visually implement the drag & drop operation.

Depending on SetDragBitmaps, dragging can start on the cell only or also on the label and item pictures.

With some type values, a drag and drop operation starts once the user moves the mouse cursor by a certain pixel distance. The pixel distance used is retrieved by using the Windows API GetSystemMetrics(SM_CX/Y/DRAG).

The settings of the RubberbandSelection property may affect the drag & drop detection.

Examples

C

              }
            };
            SftTree_SetColumnsEx(m_hwndLeftTree, 1, aCol);/* Set column attributes */
        }

        SftTree_SetShowRowHeader(m_hwndLeftTree, SFTTREE_ROWSTYLE_BUTTONCOUNT0);/* Row style */
        SftTree_SetRowHeaderStyle(m_hwndLeftTree, ES_LEFT | SFTTREE_HEADER_UP);/* Row header style */
        SftTree_SetDragBitmaps(m_hwndLeftTree, TRUE);/* Allow drag & drop from item, label pictures */
        SftTree_SetDragType(m_hwndLeftTree, SFTTREE_DRAG_PIXELIMM);/* Select and move by a number of pixels to start drag */
        SftTree_SetDropHighlightStyle(m_hwndLeftTree, SFTTREE_DROPHIGHLIGHT_BETWEEN);/* Draw line to represent drop target */
        SftTree_SetCharSearchMode(m_hwndLeftTree, SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
        /* Change the default colors */
        {
            SFTTREE_COLORS Colors;
            SftTree_GetCtlColors(m_hwndLeftTree, &Colors);/* Get current color settings */
            Colors.colorSelBgNoFocus = COLOR_BTNFACE | 0x80000000L;/* Selection background color (no input focus) */

C++

          }                              
        };
        m_LeftTree.SetColumns(1, aCol);  /* Set column attributes */
    }

    m_LeftTree.SetShowRowHeader(SFTTREE_ROWSTYLE_BUTTONCOUNT0);/* Row style */
    m_LeftTree.SetRowHeaderStyle(ES_LEFT | SFTTREE_HEADER_UP);/* Row header style */
    m_LeftTree.SetDragBitmaps(TRUE);     /* Allow drag & drop from item, label pictures */
    m_LeftTree.SetDragType(SFTTREE_DRAG_PIXELIMM);/* Select and move by a number of pixels to start drag */
    m_LeftTree.SetDropHighlightStyle(SFTTREE_DROPHIGHLIGHT_BETWEEN);/* Draw line to represent drop target */
    m_LeftTree.SetCharSearchMode(SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
    /* Change the default colors */
    {
        SFTTREE_COLORS Colors;
        m_LeftTree.GetCtlColors(&Colors);/* Get current color settings */
        Colors.colorSelBgNoFocus = COLOR_BTNFACE | 0x80000000L;/* Selection background color (no input focus) */

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