Re: Change ROW colors in a grid.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Bernhard,
Thanks for all the good input. Yes I can do most all of what you and
others are saying if I create another table or cursor. I just thought
there might be a way of not using another table or cursor but scan the
filtered table in the grid to flip flop the colors. The properties let
you address the columns but not the rows in the grid. Will work on it.
Tony

"Bernhard Sander" <fuchs@xxxxxxx> wrote in message
news:%23ANC$05HHHA.4992@xxxxxxxxxxxxxxxxxxxxxxx
Hi Tony

"Eddy Maue" <eddymaue a@t hotmail.com> wrote in message
news:mn.6d3f7d6c38904b12.66325@xxxxxxxxxxxxxxx
added lcolor and refresh that
check my example
Instead of adding a special column to the table(s) you want to show in
the grid,
use a separate cursor or table.
This separate table (let's call it ColorTable) has the additional
field of Eddy.
ColorTable should have at least the same reccount as your table. It
does not
need any index. Set a relation from your table to ColorTable based on
RECNO():
SET RELATION TO recno() INTO ColorTable
If you change filter or order in your table, use Eddy's RefreshColor
method:
with your table as active table SCAN the whole table and set
ColorTable.lColor
accordingly.
Have your grid
..SetAll("DynamicBackColor",[IIF(ColorTable.lColor,RGB(255,255,255),RGB(192,220,192))])

ColorTable could be reused for any other "your table".

This should work fast enough, if "your table" has only few (some
thousand) records.

Problem with this (and Eddy's) approach: if you edit the table in the
grid, so
that the edited record gets out of scope of the filter or changes its
position
in the sort order, the extra field must be refreshed for the whole
table. This
can be done in the cell's object valid event.
Same kind of problem comes up in multi user environment. But there I
don't see a
chance to reliably detect such changes from other users and trigger
the
RefreshColor

Regards
Bernhard Sander


.



Relevant Pages

  • Re: An awful performance issue!
    ... Also I've a grid on the form and it's populated by a physical table (say ... When I set a filter for the above table, ... But when I get rid of creating the cursor (fTmpDumCursor), ...
    (microsoft.public.fox.helpwanted)
  • Re: An awful performance issue!
    ... Also I've a grid on the form and it's populated by a physical table (say ... When I set a filter for the above table, ... But when I get rid of creating the cursor (fTmpDumCursor), ...
    (microsoft.public.fox.helpwanted)
  • Re: An awful performance issue!
    ... It means IF the cursor was created in init, ... Right click on form - Dataenvironment, should be empty because you create / use the cursors by your own. ... I apply the filter once the form is completly loaded. ... My problem is when I set the filter to the grid table of the form it takes about 10 seconds when the cursor is created. ...
    (microsoft.public.fox.helpwanted)
  • Re: Change ROW colors in a grid.
    ... I just thought there might be a way of not using another table or cursor but scan the filtered table in the grid to flip flop the colors. ... You could calculate the position of the currently refreshed row, if the table is not sorted and not filtered with the help of ..ActiveRow and .RelativeRow. ... But still then I could not get to a reliable refresh of some display specialities, since the grid decides on its own, which rows it refreshes, and it does not refresh all rows in every refresh cycle. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Determining record position in index
    ... Since you dynamically create your cursor you can delete the records you have ... I made a form with a grid and a button that refreshed the grid and set focus ... I set the grid's Highlight ... rows and pressed the refresh button. ...
    (microsoft.public.fox.programmer.exchange)