The-Drag-and-Drop-Component-Suite-for-Delphi
The-Drag-and-Drop-Component-Suite-for-Delphi copied to clipboard
Change in DragDropFormats.pas = aMedium.Stm:=Stream = problems
Hi,
before i was able to perform a DragDrop Operation fromtDropEmptySource (connected to VirtualDataformatAdapter) to tDropComboTarget (new form on same app), after changing lines 1297 and 1303 from iStream(aMedium.stm):=Stream to aMedium.Stm:=Stream it does not work any more.
Changing those lines back ... and everything is working again.
do you have a sample application please?
i changed it, because it produces a memory leak
https://github.com/landrix/The-Drag-and-Drop-Component-Suite-for-Delphi/issues/41
I use this in my big project so no small demo but changing it back solved problems on my side, don't know why but now it works
i can't reproduce it without any informations about the code in the involved eventhandler. the best way is, you can provide a little demo.
Here's some code:
onMouseDown of my cxGridView: `myFileDropSource.Files.Clear; // = tEmptyDropSource where a tvirtualdataformatadapter is connected TVirtualFileStreamDataFormat(myVirtualDataformatAdapter.DataFormat).FileNames.Clear; TVirtualFileStreamDataFormat(myVirtualDataformatAdapter.DataFormat).FileNames.add(vdatei); // add some virtual filenames // manage also a internal list with these filenames, which will be created at myEmptyDropSourceGetData..
// Start the drag operation. myEmptyDropSource.Execute();`
On the other side, at the form2 i have a tDropComboTarget where the onDrop event is never gets called after your change.
can you check the new sources again please
With your latest changes drag&drop within same app from two different forms is working again. So it seems that this bug is solved.
Stop. Not solved. Crazy. Within same app it works without problems. If i start the same app twice and try to Drag&Drop from one to the other, sometimes it works, sometimes it does not.
And it seems that the last started app can Drag&Drop TO the first started app but the first started can't Drag&drop files TO the last started app.
ok, i will switch back to the origin code
And both apps can drag&drop within the same app from different forms without any problems inkluding our own clipboardformat and dataformat. from one app to the other the own clipboard- and dataformat is not available
and the origin code works as expected in both cases?
Will try to do the same, two started exe files and drag&drop between them between different forms within the applications. I had not tested this before your update. After your change it started working within same app and different forms ... as i can remember i had no problems from different apps but will try it again.
If i drag and drop to second app, than the debugger (second started app) shows that the on getStream of virtualdataadapter is called and it returns the stream without problems but this stream is never received on app where drop is made:
procedure TmxDateianlagen.VirtualDataAdapter_OnGetStream(Sender: TFileContentsStreamOnDemandClipboardFormat; Index: integer; out AStream: IStream);
var
Stream:tStream;
vMemStream: TMemoryStream;
vFileStream: tFileStream;
vmindex:longint;
begin
// This event handler is called by TFileContentsStreamOnDemandClipboardFormat
// when the drop target requests data from the drop source (that's us).
try
try
AStream := nil; vMemStream:=tdateianlagen.FastSave2Memorystream(vmindex); // get the stream of file
Stream:=vMemStream;
if Stream.Position=0 then begin
Stream.position:=Stream.size;
end;
// ...and return the stream back to the target as an IStream. Note that the
// target is responsible for deleting the stream (via reference counting).
AStream := TFixedStreamAdapter.Create(Stream, soOwned);
finally
setlength(vlist,0);
end;
except
on e:Exception do begin
bottompanel.caption:=bottompanel.caption+',Ex:'+e.message;
if assigned(Stream) then Stream.Free;
raise;
end;
end;
end;
Can i send you a private demo, i have extracted a some functions into a demo but don't want that to be online. It is a demo with two cx-grids. You can drop a file from explorer into both + drag&drop links between them (internal clipboardformat, dataformat). If you start this app again and try to drag&drop from first app grid to second app grid it does not work.
you find my email on my github profile
thank you, i need to modify your demo, i must remove the components, that i don't have