Jump to content


Photo

Cell font color...


  • Please log in to reply
10 replies to this topic

#1 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 20 August 2008 - 11:15 AM

Hi Bogi

i chahged your component, because,
your component cell formating have 2 method for color and fontstyle

TNextGrid(FindComponent(_Grid)).Cell[kz, ik].Color
TNextGrid(FindComponent(_Grid)).Cell[kz, ik].fontstyle


and font.color not found method

i change

NxGrid.Pas

....
procedure TNextGrid.ApplyCellFormating(ACol, ARow: Integer;
Value: WideString; CellState: TCellState);
var
TextColor: TColor;
AFontStyle: TFontStyles;
begin
with Canvas do
begin
AFontStyle := Cell[ACol, ARow].FontStyle;
TextColor := Cell[ACol, ARow].FontColor; //Font.Color; //Burhan
if csBoldTextSelection in CellState then AFontStyle := AFontStyle + [fsBold];
DoCellFormating(ACol, ARow, TextColor, AFontStyle, CellState);
Font.Color := TextColor;
Font.Style := AFontStyle;
end;
end;
...



and i change nxCell.pas unit adding font.color method, please it is change add your component,


thanks.


Burhan Cakmak

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 20 August 2008 - 03:01 PM

Hello Burhan,

Thank you for your modification,

I am not sure that I can add it, because it will increase memory size used by grid. I will like to hear someone else too about adding this feature.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 20 August 2008 - 04:01 PM

Hello Boki,

CODE


Tbl_Kart.First;
Grd_Kart.AddRow(Tbl_Kart.RecordCount);
Grd_Kart.BeginUpdate;
for ik := Grd_Kart.RowCount - Tbl_Kart.RecordCount to Grd_Kart.RowCount - 1 do
begin

for kz:=0 to Grd_Kart.Columns.Count-1 do
Begin
if Tbl_Kart.FieldByName('Isaret').AsBoolean=True then
Begin
Grd_Kart.Cell[kz, ik].Color:=clYellow; // User Secelted Record in db
Grd_Kart.Cell[kz, ik].FontColor:=clBlack;
Grd_Kart.Cell[kz, ik].FontStyle:=[fsBold];
End;

if (Aktif=True) and (Tbl_Kart.FieldByName('Aktif').asBoolean = False) then
Begin
Grd_Kart.Cell[kz, ik].Color:=clBtnFace; // It is record not active
Grd_Kart.Cell[kz, ik].FontColor:=clBtnFace;
Grd_Kart.Cell[kz, ik].FontStyle:=[fsBold];
End;

if (KartTipi<>'') and (Tbl_Kart.FieldByName('KartTipi').asString = KartTipi) then
Begin
Grd_Kart.Cell[kz, ik].Color:=clBtnFace; // It is record spetsial record
Grd_Kart.Cell[kz, ik].FontColor:=ClRed;
Grd_Kart.Cell[kz, ik].FontStyle:=[fsBold];
End;

Case Grd_Kart.Columns[kz].ColumnType of
ctString : Grd_Kart.Cell[kz, ik].AsString := Tbl_Kart.FieldByName(Grd_Kart.Columns[kz].Name).AsString;
ctBoolean : Grd_Kart.Cell[kz, ik].AsBoolean := Tbl_Kart.FieldByName(Grd_Kart.Columns[kz].Name).AsBoolean;
ctFloat : Grd_Kart.Cell[kz, ik].AsFloat := Tbl_Kart.FieldByName(Grd_Kart.Columns[kz].Name).AsFloat;
ctInteger : Grd_Kart.Cell[kz, ik].AsInteger := Tbl_Kart.FieldByName(Grd_Kart.Columns[kz].Name).AsInteger;
ctDate : Grd_Kart.Cell[kz, ik].AsDateTime := Tbl_Kart.FieldByName(Grd_Kart.Columns[kz].Name).AsDateTime;
end;
End;

Tbl_Kart.Next;
end;
Grd_Kart.EndUpdate;



I am using this code, what do you thin other code this problem and font color method ?

thanks

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 20 August 2008 - 04:08 PM

Hello Burhan,

Your code is fine, but I am aware of adding new properties to Cell, because it will increase memory size. You may try to use OnCellFormating event and FontStyle and TextColor parameter.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 20 August 2008 - 04:17 PM

Hi

I using Tbl_Kart.FieldByName('Isaret').AsBoolean or Tbl_Kart.FieldByName('Aktif').AsBoolean and other field i not showing with nextgrid, sad.gif
it is column change color

thanks,

Burhan Chakak

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 20 August 2008 - 04:40 PM

Hello Burhan,

I will need to think about adding this 2 properties FontStyle and FontColor since it will increase memory use when too many cells are added.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 20 August 2008 - 04:48 PM

Hello

Thanks, i am waiting this problem and method,

Burhan Chakmak

#8 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 20 August 2008 - 04:51 PM

Hello Bogi,

i using this method row, i am table in 5 column and i using it is method 5

what do you think row method

Grd_Kart.Row[N].Color :=
Grd_Kart.Row[N].Font.Color :=
Grd_Kart.Row[N].Font.Style :=

thanks

#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 20 August 2008 - 06:01 PM

Hello Burhan,

I am not sure that I will add this properties to the row. I will need to think about adding properties to Cell. I hope that someone else may tell if this is clever step because cell will now consum more memory but customizing will be easier.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#10 Burhan Cakmak

Burhan Cakmak
  • Members
  • 24 posts

Posted 23 March 2009 - 05:48 PM

Hi Boki,

What do you change Font.color method new version ??

Burhan Cakmak

#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,194 posts
  • Gender:Male

Posted 24 March 2009 - 02:35 AM

Hello Burhan,

Unfortunatelly, I haven't add this properties yet. OnFormatingCell event still must be used

Adding Font property to a cell will dramatically increase memory usage per cell and performance.

I am sorry again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users