Subject | Re: [IBO] TIB_GRID, OnGetCellProps and BufferFields |
---|---|
Author | russellbelding |
Post date | 2004-05-25T20:18:32Z |
Hello Helen
below ...
below ...
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 10:03 AM 25/05/2004 +0000, you wrote:
> >Hello Helen
> >
> >Thanks for your reply.
> >
> >In the onGetCellProps event handler I am not interested in the
widths
> >of columns, I should have made that clear. I use the column widths
> >only in the form create procedure and the form close procedure,
> >allowing a users prior grid settings to have effect.
> >
> >Each row in the grid represents an event which may be active or
> >inactive. In a particular call by the TIB_Grid class to the event
> >handler I am interested in a setting "is the current row an active
> >event?", and I set the font and background colors by user
preference.
> >
> >In a particular call to the event handler for a particular row and
> >column, the values
> >myQuery.FieldByName(myBooleanField)asBoolean and
> >myQuery.BufferFields.Columns[MyFieldIndex].AsBoolean
> >are usually not the values for the row for which the event handler
is
> >called. Painting colors using these values paint all rows the same.
> >
> >Only when I use
> >myQuery.BufferFieldsByName(myBooleanField).AsBoolean
> >do I get good results, and then the first (FixedDataCols+1) values
> >are the values for the previous row, which is my problem.
> >
> >I have started looking in the TIB_GRID, TIB_COMPONENTS.PAS and
> >Borland code but am swamped by unfamiliar details at present.
>
> To be honest, I'm lost about what you really intend. Are you
cruising
> around the buffer and trying to launch grid events (paint
instructions)
> from there affecting the corresponding dataset buffer rows? Have
you looked
> at Gridlinks?
>
> Helen
What is intended?
I want to paint the background color and font color for each row in
the grid based on the data in the row. The painting is done inside
the OnGetCellProps event handler. Input to this handler includes
ARow, Acol (specifying the cell)
and output includes
AFont (for the text in the cell) and AColor (for the cell background
color).
The ARow values are relative to the top of the visible grid. ARow=1
is the first visible row and so on. I am not sure yet what the ACol
numbers are relative to, and the problem sems to lie with how the
BufferFields are reset with respect to ACol values.
The OnCellGetProps event is fired whenever the class needs to repaint
a cell (I don't know all the details).
The calls to the event handler are done, observing the Arow, Acol
values sent, from what appear to be a loop like
for ARow= RowStart to RowEnd
for Acol = colStart to colEnd
call handler(Arow, Acol, ...)
When the handler is entered the object associated with the grid, that
I know of, which contains best possible data for the row of the grid
specified by ARow is
myQuery.BufferFieldByName(myFieldName) (*)
By observation and instrumenting the data (writing to a DB log file)
I see that these (*) values are those for Row = ARow-1 when ACol is
between 0 and (FixedDataCols+1) (they are one row behind) and are for
row=Arow for Acol between (FixedDataCols+2) upwards (they ar for the
current row and "correct") FixedDataCols is a property of the grid.
My problem? When in the event handler which data object contains data
for the row ARow?
Have I looked at Gridlinks? Not for this purpose but will now.
Thanks,
Russell