HeaderPane
Main
Hide
Share Link
Print

DragType

Defines the portions of the combo box control where a drag & drop operation can start.

C

int WINAPI SftBox_GetDragType(HWND hwndCtl);
void WINAPI SftBox_SetDragType(HWND hwndCtl, int dragType);

C++

int CSftBox::GetDragType() const;
void CSftBox::SetDragType(int dragType);

Parameters

hwndCtl

The window handle of the combo box control.

dragType

A value describing where a drag & drop operation can be started by the user:

SFTBOX_DRAG_NONEDrag & drop is not supported. This is the default.
SFTBOX_DRAG_EDITThe drag & drop operation can start in the edit control portion of a simple or dropdown combo box. It is initiated when the left mouse button is pressed on the selected text of the edit control portion.
SFTBOX_DRAG_DROPDOWNThe drag & drop operation can start from an item in the dropdown portion and is initiated once the mouse cursor is moved by a certain pixel distance while the mouse button is pressed. An item can be dragged as it is selected.
SFTBOX_DRAG_EDITDROPDOWNThe drag & drop operation can start in the edit control portion or in the dropdown portion, as described for SFTBOX_DRAG_EDIT and SFTBOX_DRAG_DROPDOWN.

Any other value is treated as SFTBOX_DRAG_NONE.

Returns

GetDragType returns a value indicating where a drag & drop operation can be started.

Comments

The GetDragType and SetDragType functions define the portions of the combo box control where a drag & drop operation can start.

SetDragType determines when the SFTBOXN_BEGINDRAG notification is generated to notify the application that a drag & drop operation has been initiated by the user. While the user drags, SFTBOXN_DRAGGING notifications are sent. The operation ends with a SFTBOXN_ENDDRAG or SFTBOXN_CANCELDRAG notification. While processing these notifications, GetDragInfo can be used to retrieve information about the drag & drop operation.

It is the application's responsibility to visually implement the drag & drop operation.

In the dropdown portion, 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).

Examples

C View entire sample code

/*                         Combo Box Setup                            */
/**********************************************************************/

static void InitList(HWND hwndBox, LPCTSTR * alpszItems, int count)
{
    int i;

    // Items can be dragged from the list, selected text from the edit portion
    SftBox_SetDragType(hwndBox, SFTBOX_DRAG_EDITDROPDOWN);
    // A line between items shows where a dragged item will be inserted
    SftBox_SetDropHighlightStyle(hwndBox, SFTBOX_DROPHIGHLIGHT_BETWEEN);
    SftBox_SetDarkMode(hwndBox, SFTBOX_DARKMODE_AUTO);

    for (i = 0 ; i < count ; ++i)
        SftBox_AddString(hwndBox, alpszItems[i]);
    if (count > 0)

C++ View entire sample code

    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_AVAILABLE, m_Available);
    DDX_Control(pDX, IDC_SELECTED, m_Selected);
}

void CMainDlg::InitList(CSftBox& box, LPCTSTR* alpszItems, int count)
{
    // Items can be dragged from the list, selected text from the edit portion
    box.SetDragType(SFTBOX_DRAG_EDITDROPDOWN);
    // A line between items shows where a dragged item will be inserted
    box.SetDropHighlightStyle(SFTBOX_DROPHIGHLIGHT_BETWEEN);
    box.SetDarkMode(SFTBOX_DARKMODE_AUTO);

    for (int i = 0 ; i < count ; ++i)
        box.AddString(alpszItems[i]);
    if (count > 0)

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


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.