views:

489

answers:

1

Hi, I'd like to put a TComboBox in a TListView component. Any idea how I could do that ? I don't have a clue, I'm not a delphi guru x_x. Also, I can't use external components. Any help is welcome :)

+1  A: 

One method, which generally works good enough, would be to place a tComboBox on the form, but hide it. When you want the combo box to appear (for example in the OnEditing event of tListView), then display it using the rect from Item.DisplayRect(drBounds) as your coordinates (they are relative to the listview, so keep that in mind). You will also want to override the onkey down for the combobox, and handle things like tab, esc, etc. When one of these keys are pressed you want to take the appropriate action (like hiding the control, or selecting the next item to edit) . The onExit of the combobox should always hide it.

skamradt