How Change Font Size and Color in a TGrid ?!

hi everyone,

i'm a new user of firemonkey and i try to change the font color or size in a TGrid ! it's pretty easy in VCL but i don't find a way to do it in Firemonkey framework !
i already take a look to the component property and also to a way to do it by using a StyleBook (TextCellStyle) but without success !

can you help ?!

thanks
-1
javaid
12/28/2013 12:34:09 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

7 Replies
2965 Views

Similar Articles

[PageSpeed] 32

Have you figured this out?  I have the same requirement.  I would like to change column colors and font sizes in my TGrid.
-1
Eric
1/11/2014 11:49:03 PM
> {quote:title=javaid adnan wrote:}{quote}
> i'm a new user of firemonkey and i try to change the font color or size in a TGrid ! it's pretty easy in VCL but i don't find a way to do it in Firemonkey framework !
> i already take a look to the component property and also to a way to do it by using a StyleBook (TextCellStyle) but without success !


I've just added an article of changing the default grid font to my FireMonkley Guide (see below). There's also article there on 'formatting a column as currency' which explains how to do conditional formatting and will be useful if you want to change select columns or cells.

--
FireMonkey users guide http://bit.ly/10abRZX
MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
Embarcadero MVP
-1
Mike
1/12/2014 10:22:45 PM
Thank you Mike for your reply.  Do you know if there is there a way to create and apply styles at runtime?  I need to allow users to pick colors and font sizes at runtime.
1
Eric
1/13/2014 5:45:21 PM
> {quote:title=Eric Hartner wrote:}{quote}
> Thank you Mike for your reply.  Do you know if there is there a way to create and apply styles at runtime?  I need to allow users to pick colors and font sizes at runtime.

You can always set the StyleLookup property, or explicitly set the Font, FontColor and StyledSettings properties. The problem is that cells are 'recycled' as you scroll. You need to keep resetting changes in the SetData method - see the page on creating a currency column. 

If you can't directly determine the settings from the cell data, try passing in multiple values and parsing them out. E.g. pass in 'Cell Text|00FFCCAA' and separate it to get the text and colour.

If that still fails you'll need to add an event to the cell which it can call to get the necessary settings, and set it in the column's CreateCellControl method.

--
FireMonkey users guide http://bit.ly/10abRZX
MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
Embarcadero MVP
1
Mike
1/13/2014 10:40:32 PM
Mike - thank you very much!  I was able to get this to work by looking the currency example and overriding the CreateCellControl method.
-1
Eric
1/18/2014 5:54:16 PM
Hi,
I would like to change Font size of a data grid, in the cells and in the titles. Where should i go? In android, the letters are two big in the grid!
I would apreciate if you could help me.
Thanks in advance.


> {quote:title=Mike Sutton wrote:}{quote}
> > {quote:title=javaid adnan wrote:}{quote}
> > i'm a new user of firemonkey and i try to change the font color or size in a TGrid ! it's pretty easy in VCL but i don't find a way to do it in Firemonkey framework !
> > i already take a look to the component property and also to a way to do it by using a StyleBook (TextCellStyle) but without success !
> 
> 
> I've just added an article of changing the default grid font to my FireMonkley Guide (see below). There's also article there on 'formatting a column as currency' which explains how to do conditional formatting and will be useful if you want to change select columns or cells.
> 
> --
> FireMonkey users guide http://bit.ly/10abRZX
> MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
> Embarcadero MVP
1
Ana
4/17/2014 2:46:46 PM
> {quote:title=Ana Rodrigues wrote:}{quote}
> Hi,
> I would like to change Font size of a data grid, in the cells and in the titles. Where should i go? In android, the letters are two big in the grid!
> I would apreciate if you could help me.

Did you read the article I referenced?

Once you have that you'll need the post on Chris Rolliston's blog to get hold of the system styles (if you're using the defaults.

(Sorry, I can't provide direct links to either post in the forum).

--
FireMonkey users guide http://bit.ly/10abRZX
MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
Embarcadero MVP
-1
Mike
4/18/2014 12:40:57 PM
Reply: