Reputation: 605
I created a TListView in my Form, changed the ItemAppearance to DynamicAppearance. On the structure I went on ListView1> ItemAppearance> Item> Add New ...> and I picked the TTextButtonObjectAppearance.
Ok, now I want to know how can I set the OnClick event in this button, because when I double click the 'Code Tab' doesn't open, and the Event Tab in Object Inspector has nothing to choose.
Upvotes: 1
Views: 4365
Reputation: 31
Fill ListView
with ListView1.Items.Add do
begin
Text := 'Item';
Data['dateUpdate'] := '09.05.2017';
end;
OnItemClickEx event
procedure TForm1.ListView1ItemClickEx(const Sender: TObject; ItemIndex: Integer; const LocalClickPos: TPointF;
const ItemObject: TListItemDrawable);
begin
if ItemObject.Name.Equals('dateUpdate') then
ShowMessage('AppearenceObjectName = "dateUpdate"');
end;
Upvotes: 2
Reputation: 684
Set the AppearenceObjectName of the buttons to Delete and Edit.
procedure TForm2.ListView1ButtonClick(const Sender: TObject;
const AItem: TListItem; const AObject: TListItemSimpleControl);
begin
if AObject.name = 'Delete' then
showmessage('Delete')
else if AObject.Name = 'Edit' then
showmessage('Edit');
end;
Upvotes: 2