Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to put colors to records in Grid?
Message
From
05/08/1999 12:20:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/08/1999 11:56:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00249756
Message ID:
00250235
Views:
25
C.D.
It's nearly like that. Just set your expression. ie:
SetAll("DynamicBackColor","IIF(mytable.year = 1997, RGB(255,255,255) , RGB(0,255,0))", "Column")

If you really mean new records (in table buffer) you could use an exporession like :
SetAll("DynamicBackColor","IIF(RECNO( )<0, RGB(255,255,255) , RGB(0,255,0))", "Column")

It's generally easier to put a function there and decide color to apply in function code :
SetAll("DynamicBackColor","myColorPicker()", "Column")

function myColorPicker
do case
case Case1
return rgb(...)
case Case2
return rgb(...)
...
endcase

Cetin


>Nigel,
>
>The example from Help as follows:-
>
>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
>"IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;
> , RGB(0,255,0))", "Column")
>
>where it based on recno, and I need it to be based on fields. That is where I'm having problem with the coding for based on fields.
>
>Thanks,
>Gan
>
>>>All,
>>>
>>>I have my appended-records from a CURSOR displayed in a grid. The grid will display all the newly added records before the user choose "Save To Database". In the grid, I need to assign colors to rows which have the same value from a field. Example,
>>>
>>>Year CustomerID
>>>1997 A110
>>>1997 A111
>>>1997 A113
>>>1998 B456
>>>1998 B456
>>>
>>>where, all rows which contain "1997" will be having "Yellow" and the next group will have "White". Then the 3rd group, will having "Yellow" again.
>>>
>>>So, any idea of how to make this effect? Adding code in DynamicBackColor?? How?
>>>
>>>
>>>Thanks,
>>>Gan
>>
>>Look in the help for dynamicbackcolor, there is a good working example there based on record number. Just base yours on field contents instead. Also uses the SetAll() method.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform