1 (edited by sonixax 2014-11-05 01:08:42)

Topic: How to Change Grid Text Color ?

Hi,
This is the question! how can I change Grid Text Color ?!
(Not the Cell BG Color)

Re: How to Change Grid Text Color ?

Hello,

Form1.TableGrid1.Cell[3,4].TextColor := clRed;

or

Form1.TableGrid1.Cell[3,4].TextColor := $00DDEEFF;

where FF - red, EE - green, DD - blue.

Dmitry.

Re: How to Change Grid Text Color ?

Oh, Thanks a lot
And what is the correct code for Footer text color ?!

Re: How to Change Grid Text Color ?

In footer you can change only backgroud color:

Form1.TableGrid1.Columns[0].Footer.Color := clRed;
Dmitry.

Re: How to Change Grid Text Color ?

What are the colour codes available in MVDB?

Here we have only red, green and blue, and honestly speaking the blue background is just ugly!! Is it possible to set more "pastel" colours?

Re: How to Change Grid Text Color ?

Hello

I use two ways :

Form1.MyGrid.Color := clMoneyGreen;    // using name of Windows  colors

or

Form1.Edit2.Font.Color := $00000033;   // using hexa values (from a paint soft)

(As much as I remember, thr order oF RVB is not the same in delphi and HTML.
I would have to find this information)

JB

Re: How to Change Grid Text Color ?

Sorry

When I wrote RVB for colors, i wanted to say RGB (in english - RVB is the same but in French)

JB

Re: How to Change Grid Text Color ?

Thanks a lot, the clMoneyGreen is far much nicer than the clGreen big_smile

I just have to find the colour's dictionary!!

Re: How to Change Grid Text Color ?

Actually it would be nice to have the colour chart being handled by MVDB as I tried a lot of combination which all ended in "blablabla not defined"

clOrange --> does not work for example.
I tried several other colour codes from here : http://www.delphigroups.info/2/bd/428730.html
and most of them do not work...

Re: How to Change Grid Text Color ?

Hello TCoton

I commonly use a ColorPicker to chose and modulate my colours for MVB
( ie ColorUtility, many are free and very efficient, some allow to copy the result
and you have only to paste it in MVB)

In Delphi, all colors code begin with a $ (ie Form1.Edit2.Font.Color := $00000033;)

Follow this link

https://fr.wikipedia.org/wiki/Liste_de_noms_de_couleur   (sorry, it's in French)

There are all Windows colors names with hexadecimal code, RGB code, CMJ and TSL codes)

Be aware, with Delphi values R and B (for RGB) are inverted : RGB becomes for Delphi BGR  (Blue - Green - Red)

From MVB you can select your own colors by Object Inspector (See attachement)

Cordialy

JB

Post's attachments

Attachment icon Sample.jpg 16.08 kb, 397 downloads since 2015-03-03 

Re: How to Change Grid Text Color ?

Ok, thanks for the tips.
I will use the color picker from MVDB as a reference.

But definitely native windows colour names are not all working in MVDB.

The english link to wikipedia :  https://en.wikipedia.org/wiki/List_of_colors_(compact)

Re: How to Change Grid Text Color ?

To specify any colour, you can use the number hexadecimal
Example: Form1.Label1.Font.Color := $00DDEEFF;
where: FF - red, EE - green, DD - blue.


In addition, you can use the text label colours
Example: Form1.Label1.Font.Color := clWindowText;
Example: Form1.Label1.Font.Color := clRed;


The following list the color constants:
clBlack - Black
clMaroon - Maroon
clGreen - Green
clOlive - Olive green
clNavy - Navy blue
clPurple - Purple
clTeal - Teal
clGray - Gray
clSilver - Silver
clRed - Red
clLime - Lime green
clYellow - Yellow
clBlue - Blue
clFuchsia - Fuchsia
clAqua - Aqua
clWhite - White


The list the colors that map to the closest matching color in the system palette:
clDefault - The default color for the control to which the color is assigned.
clActiveBorder - Current border color of the active window.
clActiveCaption - Current color of the title bar of the active window.
clAppWorkSpace - Current color of the application workspace.
clBackground - Current background color of the Windows desktop.
clBtnFace - Current color of a button face.
clBtnHighlight - Current color of the highlighting on a button.
clBtnShadow - Current color of a shadow cast by a button.
clBtnText - Current color of text on a button.
clCaptionText - Current color of the text on the title bar of the active window.
clGradientActiveCaption - Windows 98 or Windows 2000: Right side color in the color gradient of an active window's title bar. clActiveCaption specifies the left side color.
clGradientInactiveCaption - Windows 98 or Windows 2000: Right side color in the color gradient of an inactive window's title bar. clInactiveCaption specifies the left side color.
clGrayText - Current color of text that is dimmed.
clHighlight - Current background color of selected text.
clHighlightText - Current color of selected text
clHotLight
clInactiveBorder - Current border color of inactive windows.
clInactiveCaption - Current color of the title bar of inactive windows.
clInactiveCaptionText - Current color of the text on the title bar of an inactive window.
clInfoBk - Windows 95 or NT 4.0 only: Background color for tool tip controls.
clInfoText - Windows 95 or NT 4.0 only: Text color for tool tip controls.
clMenu - Current background color of menus.
clMenuBar
clMenuHighlight
clMenuText - Current color of text on menus.
clScrollBar - Current color for the of scroll bar track.
cl3DDkShadow - Windows 95 or NT 4.0 only: Dark shadow for three-dimensional display elements.
cl3DLight - Windows 95 or NT 4.0 only: Light color for three-dimensional display elements (for edges facing the light source).
clWindow - Current background color of windows.
clWindowFrame - Current color of window frames.
clWindowText - Current color of text in windows.

Dmitry.

Re: How to Change Grid Text Color ?

Thanks Dmitry,

this is quite complete, I will try some of this settings. I just wonder why you did not mention the clMoneyGreen which is working in MVDB smile

Re: How to Change Grid Text Color ?

I think just forgot about it )

Dmitry.

Re: How to Change Grid Text Color ?

No Problem, I tried to input the colours using the hexa codes but it does not work in 1.50 beta...

Re: How to Change Grid Text Color ?

tcoton wrote:

No Problem, I tried to input the colours using the hexa codes but it does not work in 1.50 beta...

Please, show me, how exactly your using the hexa codes?

Dmitry.

Re: How to Change Grid Text Color ?

Actually, it does not work using specific scripts with dates

procedure Form1_GridEmployees_OnChange (Sender: string);
var
   i,c: integer;
   s: string;
begin
     c := Form1.GridEmployees.RowCount - 1;
     for i := 0 to c do
     begin
         s := Form1.GridEmployees.Cells[2,i];
         if ValidDate(s) then
             if (StrToDate(s) - 15) >= now then Form1.GridEmployees.Cell[2,i].Color := $0066FF66;
             if (StrToDate(s) - 15) < now then Form1.GridEmployees.Cell[2,i].Color := $0066FFFF;
             if (StrToDate(s) - 7) < now then Form1.GridEmployees.Cell[2,i].Color := clRed;
     end;
end;

I could not get this script working properly, maybe it is due to the code, I copied it from another section of the forum for tests...

I would like to change the colour of all rows in a grid depending on the date in a table (date1).


If date1 >= (today -28) = nice green
if date1 <= (today -15) = nice orange
if date1 >= (today -7) = red


This is tricky!!