Share via


CDragListBox Class

In addition to providing the functionality of a Windows list box, the CDragListBox class allows the user to move list box items, such as filenames, within the list box.

class CDragListBox : public CListBox

Members

Public Constructors

Name

Description

CDragListBox::CDragListBox

Constructs a CDragListBox object.

Public Methods

Name

Description

CDragListBox::BeginDrag

Called by the framework when a drag operation starts.

CDragListBox::CancelDrag

Called by the framework when a drag operation has been canceled.

CDragListBox::Dragging

Called by the framework during a drag operation.

CDragListBox::DrawInsert

Draws the insertion guide of the drag list box.

CDragListBox::Dropped

Called by the framework after the item has been dropped.

CDragListBox::ItemFromPt

Returns the coordinates of the item being dragged.

Remarks

List boxes with this capability allow users to order the items in a list in whatever manner is most useful to them. By default, the list box will move the item to the new location in the list. However, CDragListBox objects can be customized to copy items instead of moving them.

The list box control associated with the CDragListBox class must not have the LBS_SORT or the LBS_MULTIPLESELECT style. For a description of list box styles, see List-Box Styles.

To use a drag list box in an existing dialog box of your application, add a list box control to your dialog template using the dialog editor and then assign a member variable (of Category Control and Variable Type CDragListBox) corresponding to the list box control in your dialog template.

For more information on assigning controls to member variables, see Shortcut for Defining Member Variables for Dialog Controls.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CListBox

CDragListBox

Requirements

Header: afxcmn.h

See Also

Reference

CListBox Class

Hierarchy Chart

CListBox Class

Concepts

MFC Sample TSTCON