Trouble with TFilteredComboBox lazarus / 31-LCL ---------------------------------------------------------------------- simsee · 2020-04-25 22:25 Dear all, I want to use TFilteredComboBox, but I'm not able to obtain that the elements showed in the list dynamically change according to chars typed in the edit of control. I have tried to set Style property with all the allowed values. How is it possible to realize the desired behavior? Thanks. ---------------------------------------------------------------------- jamie · 2020-04-26 00:05 Yes. looks like someone hacked it to put the TShellListview in it instead..  even that does not work correct ether.. the FileList property is no longer there but it still shows in the code view help.. As for your autocomplete not working, I see that is also broke.. if you want to use that you can do this.. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FilterComboBox1Change(Sender: TObject);begin  FilterComboBox1.ItemIndex := FilterComboBox1.Items.IndexOf(FilterComboBox1.Caption);  FileListBox1.Mask := FilterComBoBox1.Mask;end;    I suppose that code could even be put in the control to fix it. Who knows.. ---------------------------------------------------------------------- JuhaManninen · 2020-04-26 05:40 Where can you find  TFilteredComboBox? ---------------------------------------------------------------------- eljo · 2020-04-26 05:50 ctrl+alt+p and type filter its the first of a list of 5. If I change to the palette tab it gives it under the misc page. ---------------------------------------------------------------------- simone · 2020-04-26 05:54 From the IDE is in the 'Misc' tab (the icon with a funnel). ---------------------------------------------------------------------- simsee · 2020-04-26 06:02 Quote from: jamie on April 26, 2020, 02:05:01 amYes. looks like someone hacked it to put the TShellListview in it instead..  even that does not work correct ether.. the FileList property is no longer there but it still shows in the code view help.. As for your autocomplete not working, I see that is also broke.. if you want to use that you can do this.. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FilterComboBox1Change(Sender: TObject);begin  FilterComboBox1.ItemIndex := FilterComboBox1.Items.IndexOf(FilterComboBox1.Caption);  FileListBox1.Mask := FilterComBoBox1.Mask;end;    I suppose that code could even be put in the control to fix it. Who knows..                                            Thanks Jamie. But I'm non sure to understand. Do I need an additional listbox? Can't I use the stringlist (items property) built into tfiltercombobox? ---------------------------------------------------------------------- JuhaManninen · 2020-04-26 07:36 Quote from: simone on April 26, 2020, 07:54:33 amFrom the IDE is in the 'Misc' tab (the icon with a funnel). Ahh, TFilterComboBox, not TFilteredComboBox! Ok, I have not played much with that component. ---------------------------------------------------------------------- simsee · 2020-04-26 08:24 Yes, I'm sorry for my typo... Quote from: JuhaManninen on April 26, 2020, 09:36:10 amQuote from: simone on April 26, 2020, 07:54:33 amFrom the IDE is in the 'Misc' tab (the icon with a funnel). Ahh, TFilterComboBox, not TFilteredComboBox! Ok, I have not played much with that component. ---------------------------------------------------------------------- wp · 2020-04-26 09:39 Quote from: simsee on April 26, 2020, 12:25:16 amI want to use TFilteredComboBox, but I'm not able to obtain that the elements showed in the list dynamically change according to chars typed in the edit of control. I have tried to set Style property with all the allowed values. Are you sure that TFilterCombobox is what you need? It cooperates with a ShellListView and "Filter" is here understood as a filter for file types allowing you to see in the ShellListView, for example, only the .pas files. Your description sounds as if you are seeking for the TListFilterEdit on palette LazControls. It is an edit linked to a separate listbox ("FilteredListbox"): whatever you type in the edit will be used as a filter to display ony those listbox items which match the filter string. ---------------------------------------------------------------------- simsee · 2020-04-26 10:02 I have evaluate the use of TListFilterEdit, but the associated listbox is not dropdown. ---------------------------------------------------------------------- simsee · 2020-04-26 10:12 I need this: https://en.wikipedia.org/wiki/Combo_box. The basic TComboBox behaves in a different way, so I tought to use TFilterComboBox. ---------------------------------------------------------------------- wp · 2020-04-26 10:54 I don't know of such a control, at least not within the standard Lazarus distribution. Maybe in JVCL, but certainly not among the fraction of components ported to Lazarus. Maybe in somebody else's componentset, I don't know. You could still use the TListFilterEdit when you hide the listbox initially. Add a speedbutton for the dropdown arrow. Add code which shows the listbox when the speedbutton is clicked or text is typed into the ListFilterEdit. Add code which hides the listbox when a listbox item is selected. It may get difficult to achieve the standard behavior of a combobox, though. The question is also: Is this worth the effort? Why is the standard AutoComplete feature of TCombobox not enough? P.S. Just found this: https://stackoverflow.com/questions/6667054/how-can- i-filter-the-contents-of-a-combo-box-based-on-whats-been-typed. Maybe it is helpful? ---------------------------------------------------------------------- jamie · 2020-04-26 11:14 The standard Tcombobox will do as you ask If I understand you correctly ? You need to set two properties. AutoComplete := true; AutoDropDown := true; and maybe the AutoCompleteText needs to be looked at too. This will allow you to configure how you want it to search the list.  If you are looking to keep a listbox open at all times on the form then you need to combine two controls but I don't think that is what you are after. ---------------------------------------------------------------------- wp · 2020-04-26 11:17 Quote from: jamie on April 26, 2020, 01:14:42 pmThe standard Tcombobox will do as you ask If I understand you correctly ? You need to set two properties. AutoComplete := true; AutoDropDown := true; and maybe the AutoCompleteText needs to be looked at too. This will allow you to configure how you want it to search the list. But if I did not miss anything in my experiments, it will not filter the dropdown list. ---------------------------------------------------------------------- jamie · 2020-04-26 11:32 ok, then maybe I am mistaken, too.  if that is the case then could it be just that he wants a custom loaded drop down.. almost like a word search in a dictionary where as the auto complete is actually in the list..  But that would mean a loaded list needs of all possibilities needs to be in a Tstringlist and the Onchange needs to reload the list each time for matches. ---------------------------------------------------------------------- jamie · 2020-04-26 11:51 Its amazing what controls you find broken when you start to look deeper.. for example the TComboBoxEx..  it has all the feathers Enabled of the standard combobox but the READ only is locked to READ ONLY,,, Cant change it..  SO its basically a READ only with lots of wasted properties published.. EDIT:  Yes I need to remove this control from one of my small projects..  Also unless its fixed it should be removed form Lazarus too because its basically useless without the ability to edit in there.. Lots of eye candy that can't be touched.  Because the READONLY properyty in the TCombobox has now be deactivated , controls depending in it will no longer work.  I will test the latest 2.0.8 but I doubt that it's any better. ---------------------------------------------------------------------- simsee · 2020-04-26 12:14 Thanks to all for the help. I will do some experiments. What I need is a combobox as defined in Wikipedia. The desired behavior is the following. When I type characters in the edit, if there are matches, even partial, the list goes down and shows the items that match. If there are no matches, the list disappears. All dynamically as you type, as it happens, for example, when we type in the address bar of a browser. Nothing special. I'm probably wrong about setting some properties... but I can't get exactly that. ---------------------------------------------------------------------- jamie · 2020-04-26 12:25 What you are looking for is like a Dictionary of known items and you want only the items that match or partially match to show in the list box.   And from those that match you can then scroll to select and hit enter of more than one item match..   That can be done with a little extra work... I think a Owner draw box will do it where you load your list but only show depending what is typed in the edit box. ---------------------------------------------------------------------- simsee · 2020-04-26 12:31 Ok. Thanks. I thought TListBox or TFilterListBox did this natively. ---------------------------------------------------------------------- jamie · 2020-04-26 13:58 The TFileListBox is using the OS version of viewing files.. The TFilterListBox is just re-instating the MASK property and each time it gets changed the TFileListBox updates the contents... TFilterListBox is designed to handle file extention mask. For what you want you need to have a complete list of possibilities and then ether implement a ownersdraw combo box to only show those that match or have it load the listbox of the combobox from another source as the user is typing in there text..  How long of a list are you looking at ? ---------------------------------------------------------------------- Thaddy · 2020-04-26 14:52 Add FilterRexEx , maybe? ---------------------------------------------------------------------- jamie · 2020-04-26 15:05 he most likely would want the Que banner text in there too which only is supported in windows directly..  Some controls have the hintText property for this but I don't see that in the Combobox.  I think for the most part he can load the combobox with all the possible lines and then populate another list with the matches. This way the AutoComplete text can still be used.   que banner can be enabled via a Sendmessage if you are on Windows. But I don't see how that can  help other targets