unit UPegaGrupo;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
  FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
  Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs,
  Fmx.Bind.Editors, Fmx.Bind.GenData, Data.Bind.GenData, Data.Bind.Components,
  Data.Bind.ObjectScope, FMX.ListView, Data.Bind.DBScope, Data.DB,
  Datasnap.DBClient, Data.DbxSqlite, Data.FMTBcd, Datasnap.Provider,
  Data.SqlExpr, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
  FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
  FireDAC.Comp.DataSet, FireDAC.Comp.Client, uDWConstsData, uRESTDWPoolerDB;

type
  TFPegaGrupo = class(TForm)
    ListView1: TListView;
    SterlingStyleBook: TStyleBook;
    RESTDWClientSQL1: TRESTDWClientSQL;
    BindingsList1: TBindingsList;
    BindSourceDB1: TBindSourceDB;
    LinkListControlToField1: TLinkListControlToField;
    procedure ListView1ItemClick(const Sender: TObject;
      const AItem: TListViewItem);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Selecionado: String;
  end;

var
  FPegaGrupo: TFPegaGrupo;

implementation

{$R *.fmx}

procedure TFPegaGrupo.FormActivate(Sender: TObject);
begin
  RESTDWClientSQL1.Active := False;
  RESTDWClientSQL1.Active := True;
end;

procedure TFPegaGrupo.ListView1ItemClick(const Sender: TObject;
  const AItem: TListViewItem);
begin
  Selecionado := RESTDWClientSQL1.FieldByName('ID').AsString + '|' + RESTDWClientSQL1.FieldByName('NOME').AsString;
  Close;
end;

end.
