I am using Delphi Seattle and I want to develop a very simple game.
As you can see here I here I have a grid layout and the grey squares are TButtons. My goal is to be able to move (for example) the top-left button with the number 2 above the other button below with the number 2. I have written this code:
procedure TForm1.Button1DragDrop(Sender: TObject; const [Ref] Data: TDragObject;
const [Ref] Point: TPointF);
var t,d: TButton;
T := TButton(Sender);
D := TButton(Data.Source);
T.data := T.data + D.data; //sum 2 + 2
//… other code, not relevant …
procedure TForm1.Button1DragOver(Sender: TObject; const [Ref] Data: TDragObject;
const [Ref] Point: TPointF; var Operation: TDragOperation);
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
operation := TDragOperation.Move;
operation := TDragOperation.None;
When I run this as 32-bit windows program it works fine. I am able to click on a button with the number 2 and perform a drag & drop on another button having the number 2.
This program in my Android device doesn’t work because I cannot perform the drag and drop. I have already seen some example online about this, but I cannot find a specific solution for my problem.
What could I do?