【问题标题】:Delphi android drag and drop buttonsDelphi android拖放按钮
【发布时间】:2016-11-06 13:36:59
【问题描述】:

情况

我正在使用 Delphi Seattle,我想开发一个非常简单的游戏。

正如你在这里看到的,我在这里有一个网格布局,灰色方块是TButtons。我的目标是能够(例如)将带有数字 2 的左上角按钮移动到下面带有数字 2 的另一个按钮上方。我编写了以下代码:

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; //sum 2 + 2

 //... other code, not relevant ...

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;

当我将它作为 32 位 Windows 程序运行时,它运行良好。我可以单击数字为 2 的按钮,然后在另一个数字为 2 的按钮上执行拖放操作。


问题

我的 Android 设备中的这个程序不起作用,因为我无法执行拖放操作。我已经在网上看到了一些关于此的示例,但我找不到针对我的问题的具体解决方案。

我能做什么?

【问题讨论】:

    标签: android delphi firemonkey delphi-10-seattle


    【解决方案1】:

    不幸的是,在 Android 上,“拖放”fmx 服务无法正常工作,仅在 Windows 和 IOS 上。

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-29
    • 1970-01-01
    • 2018-11-21
    • 2020-10-08
    • 1970-01-01
    • 1970-01-01
    • 2011-09-21
    相关资源
    最近更新 更多