StartDragging doesn't be trigged
StartDragging doesn't be trigged
procedure Chromium1StartDragging doesn't be trigged when some words or link were be dragged.
Only Chromium1DragEnter was trigged.
What wrong may I mistake?
Only Chromium1DragEnter was trigged.
What wrong may I mistake?
- salvadordf
- Posts: 4094
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: StartDragging doesn't be trigged
TChromium.OnStartDragging only works in OSR mode.
Re: StartDragging doesn't be trigged
Thank you!
If I drag a object, Chromium1DragEnter will be triggered two times, how to judge starting and enter?
If I drag a object, Chromium1DragEnter will be triggered two times, how to judge starting and enter?
- salvadordf
- Posts: 4094
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: StartDragging doesn't be trigged
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 ?
Are you setting "Result" to false to continue with the default drag handling behavior ?
Re: StartDragging doesn't be trigged
Oh,
I don't set Result := true;
Thank you again for your kind help!
I don't set Result := true;
Thank you again for your kind help!
Re: StartDragging doesn't be trigged
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.
- salvadordf
- Posts: 4094
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: StartDragging doesn't be trigged
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
If normal mode was used, how to solve this problem? Thank you!
- salvadordf
- Posts: 4094
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: StartDragging doesn't be trigged
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
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
Ok, Thank you!