Delphi FMX Listbox长按复制(移动平台)
功能
Delphi移动平台(Android & IOS) Listbox长按复制Detail内容
参考代码
procedure TForm1.FormCreate(Sender: TObject); //uses FMX.Platform,System.Rtti begin //初始化 TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, IInterface(FClipboardService)); end; procedure TForm1.ListBox1Gesture(Sender: TObject; const [Ref] EventInfo: TGestureEventInfo; var Handled: Boolean); //ListBox1的Touch--InteractiveGestures--LongTap要选中 begin case EventInfo.GestureID of igiLongTap: begin if ListBox1.Selected.ItemData.Detail <> '' then begin FClipboardService.SetClipboard (Tvalue(ListBox1.Selected.ItemData.Detail)); Handled := true; showmessage('已复制' + ListBox1.Selected.ItemData.Text) end; end; end; end;