unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base, FMX.Menus, FMX.ListView, System.Actions, FMX.ActnList,
FMX.ListBox, FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.ExtCtrls, FMX.Gestures;
type
TForm1 =
class(TForm)
ListView1: TListView;
PopupMenu1: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
ActionList1: TActionList;
Action1: TAction;
Action2: TAction;
Action3: TAction;
Popup1: TPopup;
GestureManager1: TGestureManager;
ListView2: TListView;
procedure Action1Execute(Sender: TObject);
procedure Action2Execute(Sender: TObject);
procedure Action3Execute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListView1Gesture(Sender: TObject;
const EventInfo: TGestureEventInfo;
var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Action1Execute(Sender: TObject);
begin
if Assigned(ListView1.Selected)
then
ShowMessage((ListView1.Selected
as TListViewItem).Text);
end;
procedure TForm1.Action2Execute(Sender: TObject);
begin
ShowMessage('
2');
end;
procedure TForm1.Action3Execute(Sender: TObject);
begin
ShowMessage('
3');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.Items.Add.Text := '
Test 1';
ListView1.Items.Add.Text := '
Test 2';
ListView1.Items.Add.Text := '
Test 3';
ListView2.Items.Add.Text := '
Test 1';
ListView2.Items.Add.Text := '
Test 2';
ListView2.Items.Add.Text := '
Test 3';
end;
procedure TForm1.ListView1Gesture(Sender: TObject;
const EventInfo: TGestureEventInfo;
var Handled: Boolean);
begin
if Assigned(ListView1.Selected)
and (EventInfo.GestureID = System.UITypes.igiLongTap)
then begin
Popup1.Placement := TPlacement.Mouse;
Popup1.IsOpen := true;
Handled := true;
end;
end;
end.