Dave Novo 51 Posted October 26, 2021 (edited) Hello, Does anyone have any tips how to make a combo box with a custom drop down editor? For example, I would like to have the dropdown editor be a treeview, and ideally use a virtual string tree as the dropdown editor. Is there a base class in the Delphi hiearchy that is designed for this, or examples of a working one. My google searches have not turned up a nice example. Edited October 26, 2021 by Dave Novo Share this post Link to post
Remy Lebeau 1394 Posted October 26, 2021 11 hours ago, Dave Novo said: Does anyone have any tips how to make a combo box with a custom drop down editor? The native VCL TComboBox does not support a custom drop down. 11 hours ago, Dave Novo said: For example, I would like to have the dropdown editor be a treeview, and ideally use a virtual string tree as the dropdown editor. There is nothing like that for the native VCL TComboBox, so you will have to use a 3rd party solution (for instance, TMS has a TAdvTreeComboBox component, and there is (an older) TreeComboBox available on Torry.net). Otherwise, you would have to write your own component. 11 hours ago, Dave Novo said: Is there a base class in the Delphi hiearchy that is designed for this No. Share this post Link to post
Fr0sT.Brutal 900 Posted October 27, 2021 (edited) I'm pretty sure there are many implementations, one of them is in EhLib. Search for "custom panel + combobox", take a look at main component packs (check awesome Delphi list in my signature). The component shouldn't be too complicated Edited October 27, 2021 by Fr0sT.Brutal Share this post Link to post
Turan Can 3 Posted October 30, 2021 Add dropdown menu and when clicked. Activate a hidden treeview menu. For example, I'm using a panel instead of a button because there is no color in the buttons 🙂 Share this post Link to post
davornik 4 Posted May 8, 2023 After searching myself for way to populate ComboBoxEx with items from TListView in order to be able to filter data I have made recursive function which iterates through all ListView data. It may be usefull. procedure TForm1.btnPopulateClick(Sender: TObject); var lvl: Integer; mNode: TTreeNode; //-- procedure PlaceTreeItem(nTree: TTreeNode; nLvl: Integer); var nIndent, nImg: Integer; NextNode, LastNode: TTreeNode; begin nIndent:=nLvl * 2; if nTree.HasChildren then nImg:=0 else nImg:=1; ComboBoxEx1.ItemsEx.AddItem(nTree.Text, nImg, nImg, nImg, nIndent, nTree.Data); if nTree.HasChildren then begin Inc(lvl); NextNode := nTree.getFirstChild; LastNode := nTree.GetLastChild; while NextNode <> nil do begin PlaceTreeItem(NextNode, lvl); if NextNode = LastNode then Dec(lvl); NextNode := NextNode.getNextSibling; end; end; end; //-- begin ComboBoxEx1.Clear; lvl:=0; mNode := TreeView1.Items.GetFirstNode; while Assigned(mNode) do begin PlaceTreeItem(mNode, 0); mNode := mNode.getNextSibling; end; end; Share this post Link to post