TOPIC: Drag and drop list
#434
Drag and drop list 3 Years, 9 Months ago
Hi

I know you can drag and drop in a tree, is it possible to drag and drop between 2 lists ? Any hints on general direction to go to would be great

Thanks
Z
 
 
#436
Re:Drag and drop list 3 Years, 9 Months ago
We don't use drag and drop too much. The tree in Library View has it. We use it in one of our applications to allow users to drag items in a list to order them.

It would be nice to use it in more places, for example in ChooseTwoList.

I'm not an expert. I think there are several ways to handle it. If you're dragging within your own user interface you can capture the mouse, create a drag image, move/change the drag image, and handle the drop all yourself. If you want to accept dragging from the operating system I think you have to handle a drop message.

Sorry, I don't know too much in this area. If you figure anything out I'd be interested in hearing about it.
 
 
andrew
 
#437
Re:Drag and drop list 3 Years, 9 Months ago
Hi

I tried to follow the implementation of the OLE function in suneido,
WINOLEAPI RegisterDragDrop(
HWND hwnd, // Handle to a window that can accept drops
IDropTarget * pDropTarget // Pointer to object that is to be target of drop
);

IDropTarget is an interface with 4 callbacks, DragEnter, DragOver, DragLeave and Drop(), All of them use the interface IDataObject

HRESULT DragEnter(
IDataObject * pDataObject,
//Pointer to the interface of the source data
// object
DWORD grfKeyState, //Current state of keyboard modifier keys
POINTL pt, //Current cursor coordinates
DWORD * pdwEffect //Pointer to the effect of the drag-and-drop
// operation
);



IDataObject is also an interface which must be called in order to receive the data. This is the one that stumps me. In order to get the data I need call IDataObject::GetData, can you define a structure in sunedio that you can call to ?

Im thinking that I may have to create a new sudataobject.cpp in order to create something with the expected default methods for IDataObject

Some resources if annyone is interested
www.catch22.net/tuts/dragdrop.asp

IDataObject
msdn.microsoft.com/library/default.asp?u...078-a9b0d5893ed4.asp


Any thoughts ?
 
 
#438
Re:Drag and drop list 3 Years, 9 Months ago
Depending on how it works you might be able to use Suneido's COM interface. Otherwise, it will probably require some C/C++ code. An alternative to modifying the exe would be to write a DLL that could be called from Suneido that would in turn call IDropTarget.

I take it that you want to handle drag and drop between other programs and Suneido?
 
 
andrew
 
#439
Re:Drag and drop list 3 Years, 9 Months ago
Id like to be able to drag & drop folders or files to a list, but I think I will settle for just dragging and dropping between lists for the time being. Like you said all I would need to do is track the mouse across the 2 different lists, store the row(s) inside the Suneido object on the initial drag and on the mouseup event over the second control transfer the rows from the Suneido object :unsure:

Something to shoot for ;)