I have noticed that there is something wrong when I use the OnDragDrop event and the OnDragOver event. Look at this piece of code:
procedure TForm1.Button1DragDrop(Sender: TObject; const [Ref] Data: TDragObject;
const [Ref] Point: TPointF);
var t,d: TButton;
begin
T := TButton(Sender);
D := TButton(Data.Source);
T.data := T.data + D.data;
Score(T.data);
D.data := 0;
T.isOk := true;
end;
procedure TForm1.Button1DragOver(Sender: TObject; const [Ref] Data: TDragObject;
const [Ref] Point: TPointF; var Operation: TDragOperation);
begin
if ((Sender is TButton) and (Data.Source is TButton) and not(Sender = Data.Source)
and (TButton(Sender).Text = TButton(Data.Source).Text) and (TButton(Data.Source).Text <> ”)) then
begin
operation := TDragOperation.Move;
end
else
begin
operation := TDragOperation.None;
end;
end;
This code is related to the form that you can see in this picture below:
This is a grid layout with some buttons inside; Button1 is the top-left one and all the other buttons have the events OnDragDrop and OnDragOver pointing to Button1 events. For example look.
When I run the program under Windows (target platform win32 bit) I am able to drag and drop the buttons in the grid using the cursor and the mouse. The problem comes out when I move to android because on my mobile I cannot drag and drop buttons. Any idea?
This is a multi-device app built with Firemonkey. I was thinking that I have to declare the DragDrop and DragOver event for every button instead of making a reference to Button1. Could this be?