Ronak Posted December 21, 2012 Posted December 21, 2012 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; Quote
Evgeny Pol Posted December 24, 2012 Posted December 24, 2012 >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; Quote
Ronak Posted December 24, 2012 Author Posted December 24, 2012 >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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.