OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Fred Tomke on March 25, 2010, 03:38:23 PM

Title: drag drop in listview
Post by: Fred Tomke on March 25, 2010, 03:38:23 PM
Hello,

I attached a small sample. It is the goal to setup a description.
When the checkbox if off, you can add or remove properties from the description by double clicking the desired items from the left list or the not desired items from the right list.
Unfortunately, double click does not work when AllowDrag is set. I hope there would be any chance to make it work again.

When the checkbox is set, the desired property can be moved from the left list to the right. The preview shall be updated automatically. That's why OnDragnDropFromControl is active.
Removing and adding properties work properly using Drag&Drop.
But changing the order within the right list does not work properly: after finishing the event OnDragnDropFromControl OpenDCL removes the moved item. I would agree this if the moved item would appear at the destination. But it does not so.

How can I solve this?

Thanks for testing.
Fred
Title: Re: drag drop in listview
Post by: owenwengerd on March 25, 2010, 06:28:23 PM
Quote from: Fred Tomke on March 25, 2010, 03:38:23 PM
But changing the order within the right list does not work properly: after finishing the event OnDragnDropFromControl OpenDCL removes the moved item. I would agree this if the moved item would appear at the destination. But it does not so.

Your OnDragnDropFromControl must insert the item being dropped. It looks like your code is completely replacing the entire list during the handler, which means the drop handler is erasing the source item. Try simplifying your code so that it only inserts the dropped item and nothing else; it should then work as you expect.
Title: Re: drag drop in listview
Post by: owenwengerd on March 25, 2010, 09:53:14 PM
The problem with being unable to double click when drag is enabled is due to an odd design of the MFC drag/drop implementation. I have now written a custom implementation for the next build that fixes the problem. I am concerned that there may be a very good reason for the MFC behavior, but in my brief testing, my custom code seems to be working fine, so we will see.
Title: Re: drag drop in listview
Post by: Fred Tomke on March 25, 2010, 11:06:16 PM
Quote from: owenwengerd on March 25, 2010, 06:28:23 PM
Try simplifying your code so that it only inserts the dropped item and nothing else; it should then work as you expect.

Yes I tried and sometimes it will remove the DropItem.
I attached a new sample.

Fred
Title: Re: drag drop in listview
Post by: owenwengerd on March 26, 2010, 07:47:03 AM
You are correct, it is removing the wrong item after the new item is inserted before the source item. I have fixed this now for the next build.
Title: Re: drag drop in listview
Post by: Fred Tomke on March 26, 2010, 08:20:03 AM
Great, thank you.
Have a nice weekend!

Fred