2

I use this code: How to make a combo box with fulltext search autocomplete support? to create custom TComboBox control with searching.

Everything was working fine but I decided to add bitmaps (pictures) into it using this method: ComboBox Simple with Bitmap

But when I added the second code I lost the searching functionality. To enable Owner drawing I added csOwnerDrawFixed style to control in constructor

constructor TComboBox.Create(AOwner: TComponent);
begin
  ...
  Style := csOwnerDrawFixed; ; << Added to enable owner draw
end;

How can I combine these two codes? The strange thing is when I run the project I can see the control redrawing correctly first time but then all data are lost and no drawing is done.

Community
  • 1
  • 1
Slappy
  • 5,250
  • 1
  • 23
  • 29
  • I am pretty sure you better forget about doing this with TComboBox and make your own control from scratch. – Warren P Oct 28 '15 at 18:18
  • You are asking a bit much for others to inspect two separate bits of code and then guess how you merged them together. :-) – Rohit Gupta Oct 31 '15 at 22:20

1 Answers1

2

@Rohit Gupta: Actually it is pretty easy to merge that 2 codes: simply place 2nd code into 1st one and rename class :)

I did this but the code is not working - painting the control causes freezing of software and I could not solve this issue that is why I asked for help.

@Warren P: you are right, the better is to create custom control which handles everything.

I created my own control which is basically TEdit with owner draw and TListBox with owner draw and TSpeedButton which works fine:

Custom control with drawing

I need to do some tweaking now and finished control will be available on my blog.

If someone is interested then grab it later on http://unsigned.sk/blog/ (I will post comment here once finished).

Thanks to all for ideas!

Community
  • 1
  • 1
Slappy
  • 5,250
  • 1
  • 23
  • 29