Link to home
Start Free TrialLog in
Avatar of christha
christha

asked on

Combobox, input when style = csOwnerDrawFixed


I want to draw different items in a
combobox with different colors.

My problem is that when style = csOwnerDrawFixed, it is no longer possible to enter text into the combobox. The delphi5 help-file says that :
" csOwnerDrawFixed :Creates an owner-draw drop-down list with an edit box for manually entered text."
   
What am I doing wrong ?
ASKER CERTIFIED SOLUTION
Avatar of AttarSoftware
AttarSoftware

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you wont use any other components...

use a edit component is very easy.

set edit.borderstyle=bsnone
put it on the combobox
add some events:

...
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  Edit1.Text:=ComboBox1.Text;
end;
...

and you can add some codes in the combobox.onenter & onexit event to control the edit 's enabled or visibled.

menxin

Avatar of christha
christha

ASKER


I tried changing the style to
csOwnerdraw and back, but the result was sort of unpredictable.

The  "fake" combobox ( editbox with
a listbox attached) works fine.
Great idea!

Thanks  :-)