|
Home > Archive > dBASE Questions and Answers > February 2006 > Colour a cell in a Grid
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Colour a cell in a Grid
|
|
| Pieter van Heerden 2006-02-16, 11:23 am |
| Is it possible to colour one cell in a grid (class)? Can the cells in different rows in the same column be given different colours?
I don't see this possibility in the Help file system, nor in Ken Mayers book. Or is this wishfull thinking?!
| |
| Jan Hoelterling 2006-02-16, 11:23 am |
| It's possible in dBase 2.6, but I have not personally used it.
Jan
"Pieter van Heerden" <psvh@mweb.co.za> wrote in message
news:hYyGkGxMGHA.1148@news-server...
> Is it possible to colour one cell in a grid (class)? Can the cells in
> different rows in the same column be given different colours?
>
> I don't see this possibility in the Help file system, nor in Ken Mayers
> book. Or is this wishfull thinking?!
>
>
| |
| Todd Kreuter 2006-02-17, 7:25 am |
| Pieter van Heerden wrote:
>
> Is it possible to colour one cell in a grid (class)? Can the cells in different rows in the same column be given different colours?
>
> I don't see this possibility in the Help file system, nor in Ken Mayers book. Or is this wishfull thinking?!
You would use the grid.columns[x].editorControls beforeCellPaint() and
onCellPaint() to do this. BeforeCellPaint to change the color,
onCellPaint to change the color back. Do a grid.refresh() in the form
onOpen to get the initial cell colors set.
function editorControl_before
CellPaint
if this.value = "YES"
this.colorNormal = "WidowText/Yellow"
endif
return
function editorControl_onCell
Paint
this.colorNormal = "WindowText/Window"
return
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2006-02-17, 7:25 am |
| Pieter van Heerden wrote:
> Is it possible to colour one cell in a grid (class)? Can the cells in different rows in the same column be given different colours?
>
> I don't see this possibility in the Help file system, nor in Ken Mayers book. Or is this wishfull thinking?!
Actually I am sure I discussed this in my book. Really ... pp 294 and
295 ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Pieter van Heerden 2006-02-17, 7:25 am |
| Ken,
Thanks, I "missread" that part, something I seem to be very good at!
Ken Mayer [dBVIPS] Wrote:
> Pieter van Heerden wrote:
>
> Actually I am sure I discussed this in my book. Really ... pp 294 and
> 295 ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Pieter van Heerden 2006-02-18, 3:23 am |
| A further question
I need to give different colours to successive rows. Identifier is an unique ID -field. BeforeCellPaint paints all successive cells the latest colour. Stopping this problem with onCellPaint [this.normsal = ""] to reset to default, clears all previous co
lour identiities already given. The previously given colours need to tbe retained.
I am thinking in terms of storing the ID field and related colour in an array and then repainting each row-cell its allotted colour, but am not to sure how to go about it.
Advice anyone, please.
Ken Mayer [dBVIPS] Wrote:
> Pieter van Heerden wrote:
>
> Actually I am sure I discussed this in my book. Really ... pp 294 and
> 295 ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Ken Mayer [dBVIPS] 2006-02-20, 9:23 am |
| Pieter van Heerden wrote:
> A further question
>
> I need to give different colours to successive rows. Identifier is
> an unique ID -field. BeforeCellPaint paints all successive cells the
> latest colour. Stopping this problem with onCellPaint [this.normsal
> = ""] to reset to default, clears all previous colour identiities
> already given. The previously given colours need to tbe retained.
>
> I am thinking in terms of storing the ID field and related colour in
> an array and then repainting each row-cell its allotted colour, but
> am not to sure how to go about it.
>
> Advice anyone, please.
In the BeforeCellPaint you will need to have code that deals with
setting the colors as needed.
do case
case somefield = somevalue
...
case somefield = a different value
otherwise
... some default
endcase
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
|
|
|
|
|