A
A
Alexander Vishnev2021-12-03 17:49:34
Delphi
Alexander Vishnev, 2021-12-03 17:49:34

How to pass text to ListView search bar?

There is a ListView with a built-in search string.
How can I insert arbitrary text into this line?
For example: "Enter a query..." or load text from the Memo field.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2021-12-03
@fromdns

procedure TForm4.Button2Click(Sender: TObject);
var
  LItem: TListViewItem;
  I: Integer;
begin
  for I := 1 to 10 do
  begin
    LItem := ListView1.Items.Add;
    LItem.Text := 'Test' + IntToStr(I);
  end;
end;

procedure TForm4.Button1Click(Sender: TObject);
  var I: Integer;
begin
for I := 0 to ListView1.Controls.Count-1 do
  if ListView1.Controls[I] is TSearchBox then
  begin
    TSearchBox(ListView1.Controls[I]).Text := 'Test5';
  end;
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question