Page 1 of 2
StartDragging doesn't be trigged
Posted: Thu Jul 16, 2020 5:48 pm
by coater
procedure Chromium1StartDragging doesn't be trigged when some words or link were be dragged.
Only Chromium1DragEnter was trigged.
What wrong may I mistake?
Re: StartDragging doesn't be trigged
Posted: Thu Jul 16, 2020 7:40 pm
by salvadordf
TChromium.OnStartDragging only works in OSR mode.
Re: StartDragging doesn't be trigged
Posted: Fri Jul 17, 2020 6:16 am
by coater
Thank you!
If I drag a object, Chromium1DragEnter will be triggered two times, how to judge starting and enter?
Re: StartDragging doesn't be trigged
Posted: Sat Jul 18, 2020 2:09 pm
by salvadordf
I tried to replicate that issue with 2 demos (normal mode and osr mode) and I only saw that event one time.
Are you setting "Result" to false to continue with the default drag handling behavior ?
Re: StartDragging doesn't be trigged
Posted: Sun Jul 19, 2020 1:42 pm
by coater
Oh,
I don't set Result := true;
Thank you again for your kind help!
Re: StartDragging doesn't be trigged
Posted: Fri Apr 30, 2021 2:52 am
by coater
Code: Select all
onDragEnter(Sender: TObject;
const browser: ICefBrowser; const dragData: ICefDragData; mask: Cardinal;
out Result: Boolean);
begin
if Dragtime2<Dragtime1 then
Dragtime2 := Now
else
Dragtime1 := Now; {}
Result := true;
if MilliSecondsBetween(Dragtime1,Dragtime2)>500 then
begin
if dragData.IsLink then
begin
aurlstr := dragData.GetLinkUrl;
SendMessage(Handle, MINIBROWSER_DRAGDATA_MESSAGE, 0, LParam(@aurlstr));
end else
begin
atitle := dragData.GetFragmentText;
if atitle <> '' then
SendMessage(Handle, MINIBROWSER_DRAGDATA_MESSAGE, 1, LParam(@atitle));
end;
end;
end;
---------------------------------------
Result := true doesn't act on repeating send.( Chromium1DragEnter will be triggered many times). so I have to add time condition.
Is there a precedure such as onDragrelease? when drag was release the procedure will be triggered.
Re: StartDragging doesn't be trigged
Posted: Sat May 01, 2021 10:29 am
by salvadordf
If your application uses the OSR mode then you can use a custom TChromiumCore with different versions of these procedures :
- TChromiumCore.DragTargetDrop(const event: PCefMouseEvent)
- TChromiumCore.DragTargetDragLeave
Re: StartDragging doesn't be trigged
Posted: Mon May 03, 2021 10:17 am
by coater
If normal mode was used, how to solve this problem? Thank you!
Re: StartDragging doesn't be trigged
Posted: Mon May 03, 2021 10:52 am
by salvadordf
The CEF project maintainer suggest using JavaScript to be notified of drag and drop events :
https://magpcss.org/ceforum/viewtopic.php?f=6&t=17115
https://magpcss.org/ceforum/viewtopic.php?f=6&t=13058
https://stackoverflow.com/questions/704564/disable-drag-and-drop-on-html-elements
Re: StartDragging doesn't be trigged
Posted: Tue May 04, 2021 11:08 pm
by coater
Ok, Thank you!