i have an application with 2 TButton, 1 TListView. I would like display the value or content(Text) of TListViewItem inside the TButton(s) in a way that the content of the first TButton can't be the same with the 2nd one. Steps =>>
When I click on the 1st TButton, I can select the Item text in the TListView and save it as new TButton text.
When I click on the 2nd TButton, I can select another item text in the same TListView, and it is saved as Text in the 2nd TButton.
My code:
....
ListView1: TListView;
Base: TButton;
Hypo: TButton;
....
procedure TMainForm.BaseClick(Sender: TObject);
begin
ListView1.Visible := True;
end;
procedure TMainForm.HypoClick(Sender: TObject);
begin
ListView1.Visible := True;
end;
procedure TMainForm.ListView1ItemClick(const Sender: TObject;
const AItem: TListViewItem);
begin
if Assigned(ListView1.Selected) and Assigned(Base.OnClick) then
begin
Base.Text := TListViewItem(ListView1.Selected).Text;
end else
if Assigned(ListView1.Selected) and Assigned(Hypo.OnClick) then
begin
Hypo.Text := TListViewItem(ListView1.Selected).Text;
end;
ListView1.Visible := False;
end;
I used LiveBindings to fill the TListView; when i run the app and select one item it works but it's displaying the same value/content in both TLabels


My first reaction, if your listview is livebinded then why don't you use livebindings to link your 2 labels ?
Second one is your code, you use Selected when you have the AItem parameter so
should be sufficient if it is not a DynamicAppearance type.