Recent

Author Topic: Is it possible to make your own TDBLookupComboBox  (Read 1567 times)

madref

  • Hero Member
  • *****
  • Posts: 1111
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Is it possible to make your own TDBLookupComboBox
« on: April 17, 2016, 09:20:39 pm »
Can you make your own TDBLookupComboBox so that the selection color is the color i want (let's say red) under Mac OSX?


If so how do i do that because i am a noob at making new components.


P.s. This does NOT work under Mac OSX (this is only for the selection color, not for the 'arrow').
Code: Pascal  [Select][+][-]
  1. procedure TForm_Wedstrijden.CB_SeizoenDrawItem(Control: TWinControl;
  2.   Index: Integer; ARect: TRect; State: TOwnerDrawState);
  3. var Str: string;
  4. begin
  5.   Str := CB_Seizoen.Items[Index];
  6.   if odSelected in State then
  7.     TDBLookUpComboBox(Control).Canvas.Brush.Color := clRed
  8.   else
  9.     TDBLookUpComboBox(Control).Canvas.Brush.Color := CB_Seizoen.Color;
  10.   TDBLookUpComboBox(Control).Canvas.FillRect(ARect);
  11.   DrawText(TDBLookUpComboBox(Control).Canvas.Handle, PChar(Str), Length(Str), ARect, DT_LEFT);
  12. end;     // CB_SeizoenDrawItem  
« Last Edit: April 17, 2016, 09:23:26 pm by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Sequoaia 15.6.1
Lazarus 4.99 (rev main_4_99-2644-gfd63613782) FPC 3.3.1 x86_64-darwin-cocoa

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

 

TinyPortal © 2005-2018