dkeene Posted September 5, 2020 Share Posted September 5, 2020 Hi Is there a way to PROGRAMMATICALLY make a unicombobox to dropdown? I am trying to decrease the number of necessary actions for use to select something based on the value of the edit box. I tried this in the OnChange method: procedure TfmTableEdit.UniComboBoxChange(Sender: TObject); var MySQL: String; MyTest: String; begin // //Populate the combo dropdown //drop down the combo listbox UniSession.AddJS(TUniDBComboBox(Sender).JSName + '.expand();'); //***************here end; This approach doesn't seem to work. any suggestions? Thank you Doug Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2020 Share Posted September 5, 2020 Hi, Sorry, can you please explain in more detail? Quote Link to comment Share on other sites More sharing options...
dkeene Posted September 5, 2020 Author Share Posted September 5, 2020 I wish to make the combobox dropdown OPEN without asking the user to click the traditional button. So, when user types a few letters in the edit box, i query a database to populate the combobox items. then I want the combobox to OPEN to present user's choices. So i need a way to OPEN the combobox programatically Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2020 Share Posted September 5, 2020 1 hour ago, dkeene said: I wish to make the combobox dropdown OPEN without asking the user to click the traditional button. So, when user types a few letters in the edit box, i query a database to populate the combobox items. then I want the combobox to OPEN to present user's choices. So i need a way to OPEN the combobox programatically I haven't looked yet, but seems you will always have a list expanded after collapse. You should use conditions to expand... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2020 Share Posted September 5, 2020 1 hour ago, dkeene said: This approach doesn't seem to work. any suggestions? 13 minutes ago, Sherzod said: but seems you will always have a list expanded after collapse procedure TMainForm.UniComboBox1Change(Sender: TObject); begin UniComboBox1.Expand; end; Quote Link to comment Share on other sites More sharing options...
dkeene Posted September 5, 2020 Author Share Posted September 5, 2020 It seems that if user is typing in the edit part of the combobox, and the list box is not showing, UniComboBox1.Expand does not drop down the listbox. In the images, user enters the blank combobox which has no Items in the dropdown. (snap123.png) user types asp (snap124.png) program queries medication database: select medication from medication_table where medication like "%asp%" -- this returns some result set. i want the dropdown to OPEN with this list without user to have to click the dropdown button. as it appears in (snap129.png) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2020 Share Posted September 5, 2020 \FMSoft\Framework\uniGUI\Demos\Desktop\ComboBox Remote Data ? Quote Link to comment Share on other sites More sharing options...
dkeene Posted September 5, 2020 Author Share Posted September 5, 2020 my question is not how to populate the listbox, but looking for the functionality such as: Delphi ComboBox.Autodropdown: Description When AutoDropDown is true, the combo box automatically drops down its list when the user starts typing a string while the combo box has focus. When AutoDropDown is false, the user must explicitly use the drop-down button to drop down the combo box list. How can I achieve this functionality with UniComboBox? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2020 Share Posted September 5, 2020 Can you try make a simple app for VCL? Quote Link to comment Share on other sites More sharing options...
dkeene Posted September 5, 2020 Author Share Posted September 5, 2020 Here is example on simple form. procedure TForm1.ComboBox1Change(Sender: TObject); var i: integer; begin for i := 0 to 3 do begin ComboBox1.Items.Add(IntToStr(random(200))) ; end; end; procedure TForm1.FormCreate(Sender: TObject); begin ComboBox1.AutoDropDown:=True; end; The point of this demo is: combobox is closed. On typing something, the dropdown list changes but automatically pops down. That is all that i want -- the autoDropDown. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 6, 2020 Share Posted September 6, 2020 20 hours ago, dkeene said: The point of this demo is: combobox is closed. On typing something, the dropdown list changes but automatically pops down. That is all that i want -- the autoDropDown. procedure TMainForm.UniFormCreate(Sender: TObject); begin UniComboBox1.MinQueryLength := 100; end; procedure TMainForm.UniComboBox1Change(Sender: TObject); var I: integer; begin for I := 0 to 3 do begin UniComboBox1.Items.Add(IntToStr(random(200))) ; end; (Sender as TUniComboBox).JSInterface.JSCallDefer('expand', [], 200); end; 1 Quote Link to comment Share on other sites More sharing options...
dkeene Posted September 6, 2020 Author Share Posted September 6, 2020 THis is perfect! Thank you. Quote Link to comment Share on other sites More sharing options...
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.