Jump to content

LiveComboBox with image


albertovesx

Recommended Posts

Hi to all.

 

I modified the LiveComboBox demo to display an image beside the text. When an item is selected, I remove the HTML marks to only display the text. but it does it with a blink that I dont like at all. Is there a better approach to do this?

 

procedure TMainForm.UniComboBox1RemoteQuery(const QueryString: string;
  Result: TStrings);
var
  I: Integer;
begin
  if Trim(QueryString)='' then Exit;

  ClientDataSet1.Filter:='country LIKE ''%'+QueryString+'%''';

  ClientDataSet1.First;
  while not ClientDataSet1.Eof do
  begin
    Result.Add(
      '<div><img src="img/accept.png" align="left"/>'
      +ClientDataSet1.FieldByName('country').AsString
      +'</div>'
    );
    ClientDataSet1.Next;
  end;
end;

procedure TMainForm.UniComboBox1Select(Sender: TObject);
begin
  UniComboBox1.Text := StringReplace(
                         UniComboBox1.Text,
                         '<div><img src="img/accept.png" align="left"/>',
                         '', []
                         );
    UniComboBox1.Text := StringReplace(
                         UniComboBox1.Text,
                         '</div>',
                         '', []
                         );
end;
 

post-610-0-07148700-1363377095_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...