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 ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is a bug...  If the combobox is owner draw, then you cannot enter text in the top bit...  Eventhe Delphi property editor doesn't do this (see the colour dropdown combo, on all controls)...

Isn't there a drop down event?

Can you set the combobox to csOwnerDraw fixed when this is fired, and back again when it is released?

Otherwise, I know we have an application we wrote here which mimics the property Editor in Delphi by using a paintBox in a scrollbox.  When you select a property, you get a tEdit with a button after it, and when you click on the button, you get an ownerdraw listbox popping up at that position...

Anyway, thats the way we do it...

Hope this helps...


PS:  You can probably pick up a component to do what you want from torrys website ( I think)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
men xinCEOCommented:
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);

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


christhaAuthor Commented:

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  :-)  

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.