Subject | SV: [IBO] Grid Problems |
---|---|
Author | Kenneth Lundblad |
Post date | 2001-03-02T18:37:18Z |
Hello Lee,
Take a look at TfrmContact.grContactGetCellProps .
The procedur is in a sample application delivered whit IB_Objects.
If you use default installation it is in
C:\IB_obj\Samples\contact\FRM_contact.pas.
This helps me to solve a similar problem.
good luck!
Kenneth Lundblad
AIR Computer I Lund AB
Sweden
-----Ursprungligt meddelande-----
Från: lee@... [mailto:lee@...]
Skickat: den 2 mars 2001 16:45
Till: IBObjects@yahoogroups.com
Ämne: [IBO] Grid Problems
I am spending already two days figuring out how this works, but it is
getting more confusing every minute.
I got a TIB_Querry and a TIB_Grid.
What I want to do is :
1) if a specified field has a spcific value , I want a partion of the
cel painted in another color.
2) If a specified field has a specific value, I want the whole row in
a specific color
Questions :
is the DrawCell the propper place to paint a specific cell ?
what is the event that is called when in a grid the next or previous
row is selected ?
How do I change the color of a selected cell ?
This is what I have produced so far.
The partially coloring of cells works, but strangely it does not
always paint the cel, when I scroll down the previous cell is painted
and when I scroll up the next cell is painted, I do not kwow why.
The second portion, where I want to change the color of the whole row
just does not work.
Maybe I am going the wrong way with this, but can someone help me
out ?
{
procedure TMain.IB_Grid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var NewRect: TRect;
var TmpField : TIB_Column;
begin
TmpField := IB_Grid1.GridFields[IB_Grid1.DataCol[ACol]];
if (Assigned( TmpField )) then
try
begin
if((TmpField.FieldName='POST') and
(TmpField.AsString='3000'))
then
begin
with Sender as TIB_Grid, Canvas do
begin
NewRect := Rect;
NewRect.Left := NewRect.Left;
NewRect.Right := NewRect.Left + 1;
Font.Color := clRed;
Brush.Color := clBlue;
FillRect(NewRect);
end;
end;
if((TmpField.FieldName='SEXE')and(TmpField.AsInteger=1)) then
begin
IB_Grid1.Canvas.Brush.Color := clred;
end
else
if((TmpField.FieldName='SEXE')and(TmpField.AsInteger=2)then
begin
IB_Grid1.Canvas.Brush.Color := clMaroon;
end;
end;
except
end;
end;
Regards
Lee
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Take a look at TfrmContact.grContactGetCellProps .
The procedur is in a sample application delivered whit IB_Objects.
If you use default installation it is in
C:\IB_obj\Samples\contact\FRM_contact.pas.
This helps me to solve a similar problem.
good luck!
Kenneth Lundblad
AIR Computer I Lund AB
Sweden
-----Ursprungligt meddelande-----
Från: lee@... [mailto:lee@...]
Skickat: den 2 mars 2001 16:45
Till: IBObjects@yahoogroups.com
Ämne: [IBO] Grid Problems
I am spending already two days figuring out how this works, but it is
getting more confusing every minute.
I got a TIB_Querry and a TIB_Grid.
What I want to do is :
1) if a specified field has a spcific value , I want a partion of the
cel painted in another color.
2) If a specified field has a specific value, I want the whole row in
a specific color
Questions :
is the DrawCell the propper place to paint a specific cell ?
what is the event that is called when in a grid the next or previous
row is selected ?
How do I change the color of a selected cell ?
This is what I have produced so far.
The partially coloring of cells works, but strangely it does not
always paint the cel, when I scroll down the previous cell is painted
and when I scroll up the next cell is painted, I do not kwow why.
The second portion, where I want to change the color of the whole row
just does not work.
Maybe I am going the wrong way with this, but can someone help me
out ?
{
procedure TMain.IB_Grid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var NewRect: TRect;
var TmpField : TIB_Column;
begin
TmpField := IB_Grid1.GridFields[IB_Grid1.DataCol[ACol]];
if (Assigned( TmpField )) then
try
begin
if((TmpField.FieldName='POST') and
(TmpField.AsString='3000'))
then
begin
with Sender as TIB_Grid, Canvas do
begin
NewRect := Rect;
NewRect.Left := NewRect.Left;
NewRect.Right := NewRect.Left + 1;
Font.Color := clRed;
Brush.Color := clBlue;
FillRect(NewRect);
end;
end;
if((TmpField.FieldName='SEXE')and(TmpField.AsInteger=1)) then
begin
IB_Grid1.Canvas.Brush.Color := clred;
end
else
if((TmpField.FieldName='SEXE')and(TmpField.AsInteger=2)then
begin
IB_Grid1.Canvas.Brush.Color := clMaroon;
end;
end;
except
end;
end;
Regards
Lee
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/