PRB: Drag List Box Does Not Send DL_DRAGGING Notification

ID: Q183115

The information in this article applies to:

SYMPTOMS

A drag list box in an improperly coded dialog box sends DL_BEGINDRAG and DL_DROPPED notifications, but no DL_DRAGGING notifications.

CAUSE

The DragList control relies on the value that is returned in response to its DL_BEGINDRAG notification in order to acknowledge the start of the drag. If this value is not returned properly, the further drag messages will not be sent.

RESOLUTION

In a Dialog Box, the value returned from the dialog box procedure is a BOOL that tells DefDlgProc whether or not the message has been handled. The returned value is not the value that is returned as the result of a sent message. To properly return a value from a dialog box procedure, the return value needs to be placed in the DWL_MSGRESULT window long position, and then TRUE must be returned from the dialog box procedure:

   case DL_BEGINDRAG:
      // Keep track of the item number that is being dragged.
      // In this case, store the number in the dialog box's
      // DWL_USER position.
      SetWindowLong(hwnd,DWL_USER,
                    LBItemFromPt(dli->hWnd,dli->ptCursor,FALSE));
      // Store the return value in DWL_MSGRESULT.
      SetWindowLong(hwnd,DWL_MSGRESULT,TRUE);
      break;

STATUS

This behavior is by design.

Additional query words:

Keywords          : kbCtrl kbDragList kbNTOS kbGrpUser kbWinOS 
Issue type        : kbprb

Last Reviewed: December 17, 1998