[MSEide-MSEgui-talk] tstringgird individual cell color

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] tstringgird individual cell color

PatG
I can set a column of a stringgrid to a specific color using
tstringgrid.datacols.cols [n].color := cl_green;

Is it possible to set a specific column/row only to a color?  What is
the correct pascal coding to do it (I haven't been able to get it right
yet)?


--
Patrick Goupell

Are you free?  Find out at http://www.sedm.org/
Income taxes?  Find out at http://www.whatistaxed.com


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] tstringgird individual cell color

mse
Administrator
On Thursday 09 August 2018 20:11:52 Patrick Goupell wrote:
> I can set a column of a stringgrid to a specific color using
> tstringgrid.datacols.cols [n].color := cl_green;
>
> Is it possible to set a specific column/row only to a color?  What is
> the correct pascal coding to do it (I haven't been able to get it right
> yet)?

It is possible to set a color to a specific row by setting
<grid>.rowcolors[<row>].
An other option is to set <grid>[<col>][<row>].selected which shows
<grid>[<col>].colorselect.
Individual cell colors must be set in
<grid>.datacols[<col>].onbeforedrawcell().
"
procedure tmainfo.befdrawcellev(const sender: tcol; const canvas: tcanvas;
               var cellinfo: cellinfoty; var processed: Boolean);
begin
 if cellinfo.cell.row = 2 then begin
  cellinfo.color:= cl_green;
 end;
end;
"
Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] tstringgird individual cell color

PatG


On 08/10/2018 01:41 AM, Martin Schreiber wrote:

>
> It is possible to set a color to a specific row by setting
> <grid>.rowcolors[<row>].
> An other option is to set <grid>[<col>][<row>].selected which shows
> <grid>[<col>].colorselect.
> Individual cell colors must be set in
> <grid>.datacols[<col>].onbeforedrawcell().
> "
> procedure tmainfo.befdrawcellev(const sender: tcol; const canvas: tcanvas;
>                 var cellinfo: cellinfoty; var processed: Boolean);
> begin
>   if cellinfo.cell.row = 2 then begin
>    cellinfo.color:= cl_green;
>   end;
> end;
> "
> Martin
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> mseide-msegui-talk mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

using sgLog.rowcolors [i] := cl_green gives error "List index (0) out of
bounds."

The grid has one row and i is 0;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] tstringgird individual cell color

mse
Administrator
On Friday 10 August 2018 16:50:35 Patrick Goupell wrote:
> > https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
>
> using sgLog.rowcolors [i] := cl_green gives error "List index (0) out of
> bounds."
>
Please use
"
 sgLog.rowcolorstate[i]:= <colornumber>;
"
<colornumber> selects one of the colors in sgLog.rowcolors property which can
be defined at designtime. <-1> means none.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk