Jump to content

UniComboBox1.Text Remote Query


Ronak

Recommended Posts

Hello,

 

In UniComboBox,

 

when I set the text of an UniComboBox using button click,

 

UniComboBox1.Text:='Malvinas';

 

Once popup list will show the records Like % 'Malvinas', Ok fine

 

now, again re-set the text using button click,

 

UniComboBox1.Text:='United';

popup list is still showing the records related to 'Malvinas', expected to show records Like % 'Malvinas'.

 

 

How can I instruct UniComboBox to re-execute remote query?

 

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniComboBox1.Text:='Malvinas';
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  UniComboBox1.Text:='United';
end;

procedure TMainForm.UniComboBox1RemoteQuery(const QueryString: string; Result: TStrings);
var
 I: Integer;
 s: String;
begin
 if Trim(QueryString)='' then
     s:=UniComboBox1.Text
 else
     s:=QueryString;
 if Trim(s)='' then Exit;
 ClientDataSet1.Filter:='country LIKE ''%'+ s+'%''';
 ClientDataSet1.First;
 while not ClientDataSet1.Eof do
 begin
   Result.Add(ClientDataSet1.FieldByName('country').AsString);
   ClientDataSet1.Next;
 end;
end;

Link to comment
Share on other sites

>popup list is still showing the records related to 'Malvinas', expected to show records Like % 'Malvinas'.

You wanted to say: ... expected to show records Like '%United'?

The following code will help you

 

procedure TMainForm.UniButton2Click(Sender: TObject);

begin

UniComboBox1.Clear;

UniComboBox1.Text:='United';

UniComboBox1RemoteQuery(UniComboBox1.Text,UniComboBox1.Items);

end;

Link to comment
Share on other sites

>popup list is still showing the records related to 'Malvinas', expected to show records Like % 'Malvinas'.

You wanted to say: ... expected to show records Like '%United'?

The following code will help you

 

procedure TMainForm.UniButton2Click(Sender: TObject);

begin

UniComboBox1.Clear;

UniComboBox1.Text:='United';

UniComboBox1RemoteQuery(UniComboBox1.Text,UniComboBox1.Items);

end;

 

Yes, This code helped

 

Thanks

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...