Reputation: 393
My question relates to the use of Firemonkey TListView in Delphi 10.2 Tokyo.
I have a FMX form with a ListView with ItemAppearance.ItemApearance = which allows me to add any number of TTextObjectAppearance items.
The TListView has LiveBindings to TFDQuery fields via a TBindSourceDB. All my fields display as I want them to in the ListView.
I do not wish to display the primary key from that query to the user but I do want to be able to receive the primary key once the user selects an item in the listview.
The goal is to be able to locate the row in the TFDQuery dataset that contains other columns of information required to generate the next screen.
I would much appreciate your advice. Thanks in advance.
Upvotes: 1
Views: 1379
Reputation: 393
A solution for TListView based on asd-tm's comment worked for me.
For the original post see see this.
procedure TForm1.LinkFillControlToFieldPKFillingListItem(Sender:
TObject; const AEditor: IBindListEditorItem);
begin
(AEditor.CurrentObject as TListItem).Tag := FDQuery1.FieldByName('PK').AsInteger;
end;
procedure TForm1.ListView1ItemClick(const Sender: TObject; const
AItem: TListViewItem);
begin
FDQuery1.IndexFieldNames := 'PK';
FDQuery1.SetKey;
FDQuery1.FieldByName('PK').AsInteger := AItem.Tag;
if FDQuery1.GotoKey then
//...
end;
Upvotes: 1