Article

From:
To:
Dmitry Gultyaev
Subject:
Re: Drag and Drop problem
Newsgroup:
embarcadero.public.delphi.firemonkey
URL:
Shortcut to this article
Printer Friendly
 

Re: Drag and Drop problem

Hello,

I was searching for a long time, how the drag & drop on Firemonkey works. Please can u send me an code-sample how i can do drag & drop with listbox or stringgrid items ?
Thx Matthias


> {quote:title=Dmitry Gultyaev wrote:}{quote}
> Hi, I was trying to add a simple drag n drop functionality to application. It is now much easier to make, but..
> There is a general problem of drag n drop functionality in XE4 and probably XE5. Basically it is not possible to drag something to a control, that is placed on layout. I have everything on layouts and drag n drop just not working.
> I fixed myself this issue in FMX.Forms by changing following procedure:
> {code}function TCommonCustomForm.FindTarget(P: TPointF; const Data: TDragObject): IControl;
> var
>   i: Integer;
>   NewObj: IControl;
> begin
>   Result := nil;
>   for i := 0 to ChildrenCount - 1 do
>     // add an exception for layouts
>     if Supports(Children[i], IControl, NewObj) and NewObj.Visible and (NewObj.HitTest or (NewObj is TLayout)) then
>     begin
>       NewObj := NewObj.FindTarget(P, Data);
> 
>       if Assigned(NewObj) then
>         Exit(NewObj);
>     end;
> end;{code}
FYI: Phrase searches are enclosed in either single or double quotes
 
 
 
24-Jul 11:00 utc Operating system upgrade in process, expect some down time.
Originally created by
[Tamarack]
Fri, 20 Oct 2017 03:05:14 UTC
Copyright © 2009-2017
HREF Tools Corp.