landrix / The-Drag-and-Drop-Component-Suite-for-Delphi

MIT License
161 stars 57 forks source link

Frustrated with Demos and components.. #47

Closed ijbranch closed 3 years ago

ijbranch commented 3 years ago

Hi Team, Win 10, 64bit. Latest Drag&Drop, D10.4.1. 32bit Apps. My specific need is to be able to drag & drop .jpg files into a Table Blob field via a DBImage component. I installed D&D without issue. I then opened the SimpleTargetDemo just to see how it all fits together. For some reason, DropImageTarget cannot see TImage as a Target. :-( Hmmm. OK, add a DBImage to the Demo, ahh, it can see DBImage as a Target. :-) Build & Run the App, grab a .jpg file and drag it over the DBImage area. All I get is faded image of what I am trying to drop and a Stop symbol. :-( I will be the first to admit I have probably got something wrong but I don't know what. Please advise. Regards & TIA, Ian

landrix commented 3 years ago

in case of TImage, i think, you should set WinTarget instead of Target

ijbranch commented 3 years ago

I don't understand why that should be? All the other components on the Demo form are seen but not TImage. WinTarget expects a Win HNDL, how does one get that for TImage??

landrix commented 3 years ago

take a look at DropBMPTarget1 in

https://github.com/landrix/The-Drag-and-Drop-Component-Suite-for-Delphi/blob/master/Demos/DetailedDemo/DropURL.pas

you must wrap TImage with a helper panel

ijbranch commented 3 years ago

OK. Working in the 'SimpleTargetDemo' I did that, put the TImage on a TPanel. Added the following code.. procedure TForm1.DropImageTarget1Drop(Sender: TObject; ShiftState: TShiftState; APoint: TPoint; var Effect: Integer); begin // An image has just been dropped on the target - Copy it to // our TImage component Image1.Picture.Assign(DropImageTarget1.Picture); end; Tried to drag an image to it with the attached the result. I am still missing something. :-( Screenshot_8 The picture I was dragging is a .jpg file and I was dragging it from my Pictures folder. When I released/dropped the picture nothing happened.

landrix commented 3 years ago

Sry, i can't help, if i not see the complete code

which type is DropImageTarget1?

ijbranch commented 3 years ago

I am using the SimpleTargetDemo as supplied with D&D. The component is the one already on the from, TDropImageTarget. All I have done att is put the TImage that was on the form, onto a TPanel on the form and added the additional drop code. TargetDemo.zip

landrix commented 3 years ago

this works for me

TargetDemo.zip

why TDropImageTarget dosn't work, i don't know

ijbranch commented 3 years ago

Ahhh Ha! Excellent. Thank you. Now I can move forward with my little project. :-) Regards & Tks again, Ian

landrix commented 3 years ago

gladly