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

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...