Is it possible to store values in a cursor to format cells in a grid?

For example, I've the cursor:
Field1 Field2 Field3
-1 1 3
1 -1 2

and the table:
Field1 Field2 Field3
aa bb cc
dd ee ff

I would like to display the table using a grid with blue background cells
for positive values of the same field of the same record in the cursor and
red for negative values, like this:

The grid:
Field1 Field2 Field3
aa (RED) bb (BLUE) cc (BLUE)
dd (BLUE) ee (RED) ff (BLUE)

Any suggestions?

Thanks in advance!

Lorenzo

Re: Different cell color in a grid using a cursor by Andrew

Andrew
Thu Sep 16 04:16:30 CDT 2004

If you create a function (or method of the grid class in question) thus

FUNCTION dycol
LPARAMETERS liRec, lcField
LOCAL liReturn
SELECT nums
GO liRec
IF nums.&lcField < 0
liReturn = 255
ELSE
liReturn = RGB(0, 0, 255)
ENDIF
SELECT lets
RETURN liReturn
ENDFUNC

you can then set the dynamicbackcolor for each column thus,

grid1.column1.DynamicBackColor="dycol(RECNO('lets'), 'field1')"
grid1.column2.DynamicBackColor="dycol(RECNO('lets'), 'field2')"
grid1.column3.DynamicBackColor="dycol(RECNO('lets'), 'field3')"

lets is the cursor I have used for the table, and nums for the cursor

Andrew R.


"Lorenzo" <lorNOSPPPAM299@yahoo.com> wrote in message
news:cibhju$8nf$1@lacerta.tiscalinet.it...
: Is it possible to store values in a cursor to format cells in a grid?
:
: For example, I've the cursor:
: Field1 Field2 Field3
: -1 1 3
: 1 -1 2
:
: and the table:
: Field1 Field2 Field3
: aa bb cc
: dd ee ff
:
: I would like to display the table using a grid with blue background cells
: for positive values of the same field of the same record in the cursor and
: red for negative values, like this:
:
: The grid:
: Field1 Field2 Field3
: aa (RED) bb (BLUE) cc (BLUE)
: dd (BLUE) ee (RED) ff (BLUE)
:
: Any suggestions?
:
: Thanks in advance!
:
: Lorenzo
:
:
:
:



Re: Different cell color in a grid using a cursor by Lorenzo

Lorenzo
Thu Sep 16 08:16:21 CDT 2004


"Andrew R" <adr.notme@sarcastic.co.uk> ha scritto nel messaggio
news:2qt3vgF13qm2cU1@uni-berlin.de...
> If you create a function (or method of the grid class in question) thus
>
Perfect! Thanks!

Lorenzo