Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to write in TCombobox - Berlin


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: May 4, 2017 3:30 PM Last Post By: Remy Lebeau (Te...
Md. Shariful Al...

Posts: 70
Registered: 9/9/01
How to write in TCombobox - Berlin  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2017 2:26 PM
Like in VCL, if TComobox style=csDropDown it can write and auto search text in TComboBox Items. How to do it in Firemonkey only in Windows? In Firemonkey TComboBox is totally for selecting item from Items as per other OS but how can it be done in Windows?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to write in TCombobox - Berlin  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2017 3:30 PM   in response to: Md. Shariful Al... in response to: Md. Shariful Al...
Md Shariful Alam Khan wrote:

Like in VCL, if TComobox style=csDropDown it can write and auto
search text in TComboBox Items. How to do it in Firemonkey only
in Windows? In Firemonkey TComboBox is totally for selecting item
from Items as per other OS but how can it be done in Windows?

FireMonkey's TComboBox does not support that. You have to simulate it yourself,
such as with a separate TEdit that searches the Items, ie:

uses
  ..., StrUtils;
 
procedure TForm1.Edit1Typing(Sender: TObject);
var
  I, Len: Integer;
  S: String;
begin
  for I := 0 to ComboBox1.Items.Count-1 do
  begin
    S := ComboBox1.Items[I];
    if StartsText(Edit1.Text, S) then
    begin
      Len := Length(Edit1.Text);
      Edit1.Text := S;
      Edit1.SelStart := Len;
      Edit1.SelLength := Length(S)-Len;
      Exit;
    end;
  end;
end;


--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02