Jump to content
  • Advertisement
Sign in to follow this  
ms291052

Drag-Drop List Boxes with Win32

This topic is 4923 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my current project it would be very nice to have a list box control that allows for its elements to be rearranged based on user input. Is it possible to do this by dragging and dropping the new items into the new spot in windows? If not, what would be the best substitute? I am stuck at the idea of using two buttons, "move current up" and "move current down". While it would work, it's not exactly the elegant solution I was hoping for. Any advice? ms

Share this post


Link to post
Share on other sites
Advertisement
Hi!

Yes, it's possible to write a drag and drop listbox. The following messages are used to implement it:

DL_BEGINDRAG
DL_CANCELDRAG
DL_DRAGGING
DL_DROPPED

Search in Google for it or check out the MFC source code. There's one class named CDragListBox, which implements exactly what you want.

The following site could be a help:
http://www.winapi.net/index.php?inhalt=s44

Bye, hunta

Share this post


Link to post
Share on other sites
If you have a standard list box (NOT list control) you can call MakeDragList once to enable dragging of listbox items.

If an items is dragged and dropped onto the listbox the parent receives a RegisterWindowMessage( DRAGLISTMSGSTRING ) value. The lParam carries the DL_xxx params hunta mentioned.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!