Subject | Re: OnDrawCell handler |
---|---|
Author | Sergey Kanovka |
Post date | 2000-12-28T20:35:09Z |
Hi,
I also have problem with custom drawing. I can not use method
suggested by Ingo, because I do not show in grid column which value I
use as a base for drawing bitmap.
IB_Query.FieldByName does not work. Is there another way to obtain a
current value of particular field of dataset attached to grid?
Wednesday, November 29, 2000, 2:00:30 AM, you wrote:
Ingo Jansen> Hi Tomas,
Ingo Jansen> i have the same problem when i want to draw a image in the cell. I
Ingo Jansen> changed my code that way that dont use the dataset.fieldbyname
Ingo Jansen> ('').value, i use something like this -
Ingo Jansen> if strtoInt(TIB_Grid(Sender).GetCellDisplayText(aCol,ARow))=2 then
Ingo Jansen> begin
Ingo Jansen> TIB_Grid(Sender).Canvas.Font.Color := clRed;
Ingo Jansen> TIB_Grid(Sender).DefaultDrawCell(ACol, ARow, Rect, State,...
Ingo Jansen> end;
Ingo Jansen> and then i the problem was solved. i hope it's a solution for your
Ingo Jansen> prolem too.
Ingo Jansen> --- In IBObjects@egroups.com, Tomas MichalĂk <michalik@p...> wrote:
I also have problem with custom drawing. I can not use method
suggested by Ingo, because I do not show in grid column which value I
use as a base for drawing bitmap.
IB_Query.FieldByName does not work. Is there another way to obtain a
current value of particular field of dataset attached to grid?
Wednesday, November 29, 2000, 2:00:30 AM, you wrote:
Ingo Jansen> Hi Tomas,
Ingo Jansen> i have the same problem when i want to draw a image in the cell. I
Ingo Jansen> changed my code that way that dont use the dataset.fieldbyname
Ingo Jansen> ('').value, i use something like this -
Ingo Jansen> if strtoInt(TIB_Grid(Sender).GetCellDisplayText(aCol,ARow))=2 then
Ingo Jansen> begin
Ingo Jansen> TIB_Grid(Sender).Canvas.Font.Color := clRed;
Ingo Jansen> TIB_Grid(Sender).DefaultDrawCell(ACol, ARow, Rect, State,...
Ingo Jansen> end;
Ingo Jansen> and then i the problem was solved. i hope it's a solution for your
Ingo Jansen> prolem too.
Ingo Jansen> --- In IBObjects@egroups.com, Tomas MichalĂk <michalik@p...> wrote:
>> Hi all,Ingo Jansen> haven't
>>
>> It is the first time I tried to do custom drawing in grid and I
>> succeded :-(Ingo Jansen> = 'PRP_MNOZSTVI'
>> Here is the handler - it is only test:
>>
>> procedure TfTransfer.IB_Grid1DrawCell(Sender: TObject; ACol, ARow:
>> Integer;
>> Rect: TRect; State: TGridDrawState);
>> begin
>> if TIB_Grid(Sender).DataSource.Dataset.Active then
>> begin
>> if TIB_Grid(Sender).GridFields[ACol-1].FieldName
>> thenIngo Jansen> ('PRP_MNOZSTVI').AsCurrency
>> if
>> TIB_Grid(Sender).DataSource.Dataset.FieldByName
>> = 2 thenIngo Jansen> ('PRP_MNOZSTVI').AsString,
>> begin
>> TIB_Grid(Sender).Canvas.Font.Color := clRed;
>> TIB_Grid(Sender).DefaultDrawCell(ACol, ARow, Rect, State,
>>
>> TIB_Grid(Sender).DataSource.Dataset.FieldByName
>> taCenter);Ingo Jansen> way. It
>> end;
>> end;
>> end;
>>
>> I want to change the font color to clRed in all the cells where the
>> value of column PRP_MNOZSTVI is 2. My code works in a different
>> changes the font color only when the row that meets the condition isIngo Jansen> fills
>> active/selected. But in such a case it changes the font color and
>> this value into all rows for this column.Ingo Jansen> being
>> How do I get the actual field values for the row that is currently
>> painted in a grid ?Ingo Jansen> with
>>
>> P.S. I think it worked when I used similar solution long time ago
>> TDBGrid and TTable.Serge
>>
>> Best regards,
>> Tom
>>