Grid Control - Individual Row Background Color, other methods
Another alternative, if you can set up your tables/cursors this way, is to
add fields such as "Back_Color" and "Fore_Color" and populate them with the
desired RGB() values (as part of a SQL-Select or with REPLACE statements),
and then simply set the colors with:
WITH frmMyForm.grdGrid1
.SetAll("DynamicBackColor", "Back_Color", "Column")
.SetAll("DynamicForeColor", "Fore_Color", "Column")
ENDWITH
You can then have as much of a rainbow-color system as you like, without
having highly complex commands in the Dynamic*Color properties.
"Brian Wallpe" <bwallpe@roeing.com> wrote:
>
>If the code you posted for setting the DynamicBackcolor is accurate, the
problem
>is you don't have the correct number of close-parenthesis.
>Depending on the error-handler settings in effect, you may get a message
>about an invalid setting for DynamicBackColor, or you get no message at
all.
>When you have an illegal expression in the Dynamic* properties, it will
use
>the default values, and you may also notice a dramatic slow-down in the
speed
>that the grid is displayed.
>
>
>"Mark Kirchner" <markkirchner@lvcm.com> wrote:
>>I don't think so. I tried using the example they give in the help, and
I
>can
>>alternate colors using the example code as follows:
>>
>>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
>> "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) , RGB(0,255,0))", "Column")
>>
>>but when I modify the example code with another embedded iif() statement,
>it
>>doesn't work. All rows are white.
>>
>>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
>> "IIF(dbfs.field_type='C', RGB(255,255,255), IIF(field_type='N',
>>RGB(255,0,0), RGB(0,255,0))", "Column")
>>
>>Mark
>>
>><Tamar E. Granor> wrote in message
>>news:inivavgior62vsrs5eioqu3phmui0dkqpn@4ax.com...
>>> On Tue, 29 Apr 2003 19:20:59 -0700, "Mark Kirchner"
>>> <markkirchner@lvcm.com> wrote:
>>>
>>> >I need to be able set/control the back color of each row in a grid
>>> >individually. I am currently using the flexgrid control but this is
too
>>slow
>>> >as I can't bind the data to the control(at least not that I know of),
>and
>>> >therefore have to manually insert each row from the data source and
set
>>the
>>> >properties and colors appropriately. I can actually see the screen
>>painting
>>> >and once the record count hits more than 20, it's too slow.
>>> >
>>>
>>> Can you do what you need with the DynamicBackColor property?
>>>
>>> Tamar
>>
>>
>
# 1 Re: Grid Control - Individual Row Background Color, other methods
Thanks for the tip and info. This looks like exactly what I need!
BTW, this is for a tow company's dispatch system, and that's basically what
they want - a rainbow of colors to distinguish all their different types of
dispatches.
Mark
"Brian Wallpe" <bwallpe@roeing.com> wrote in message
news:3eb03802$1@tnews.web.dev-archive.com...
>
> Another alternative, if you can set up your tables/cursors this way, is to
> add fields such as "Back_Color" and "Fore_Color" and populate them with
the
> desired RGB() values (as part of a SQL-Select or with REPLACE
statements),
> and then simply set the colors with:
>
> WITH frmMyForm.grdGrid1
> .SetAll("DynamicBackColor", "Back_Color", "Column")
> .SetAll("DynamicForeColor", "Fore_Color", "Column")
> ENDWITH
>
> You can then have as much of a rainbow-color system as you like, without
> having highly complex commands in the Dynamic*Color properties.
>
>
> "Brian Wallpe" <bwallpe@roeing.com> wrote:
> >
> >If the code you posted for setting the DynamicBackcolor is accurate, the
> problem
> >is you don't have the correct number of close-parenthesis.
> >Depending on the error-handler settings in effect, you may get a message
> >about an invalid setting for DynamicBackColor, or you get no message at
> all.
> >When you have an illegal expression in the Dynamic* properties, it will
> use
> >the default values, and you may also notice a dramatic slow-down in the
> speed
> >that the grid is displayed.
> >
> >
> >"Mark Kirchner" <markkirchner@lvcm.com> wrote:
> >>I don't think so. I tried using the example they give in the help, and
> I
> >can
> >>alternate colors using the example code as follows:
> >>
> >>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
> >> "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) , RGB(0,255,0))", "Column")
> >>
> >>but when I modify the example code with another embedded iif()
statement,
> >it
> >>doesn't work. All rows are white.
> >>
> >>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
> >> "IIF(dbfs.field_type='C', RGB(255,255,255), IIF(field_type='N',
> >>RGB(255,0,0), RGB(0,255,0))", "Column")
> >>
> >>Mark
> >>
> >><Tamar E. Granor> wrote in message
> >>news:inivavgior62vsrs5eioqu3phmui0dkqpn@4ax.com...
> >>> On Tue, 29 Apr 2003 19:20:59 -0700, "Mark Kirchner"
> >>> <markkirchner@lvcm.com> wrote:
> >>>
> >>> >I need to be able set/control the back color of each row in a grid
> >>> >individually. I am currently using the flexgrid control but this is
> too
> >>slow
> >>> >as I can't bind the data to the control(at least not that I know of),
> >and
> >>> >therefore have to manually insert each row from the data source and
> set
> >>the
> >>> >properties and colors appropriately. I can actually see the screen
> >>painting
> >>> >and once the record count hits more than 20, it's too slow.
> >>> >
> >>>
> >>> Can you do what you need with the DynamicBackColor property?
> >>>
> >>> Tamar
> >>
> >>
> >
>