Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use DynamicBackColor w/o using RECNO()
Message
 
To
03/02/2007 02:19:49
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01192085
Message ID:
01192287
Views:
18
>Hi All,
>
>I would like to show records via a grid control with an alternating backcolor.
>
>The following works well if based on the RECNO() function, like so:
>
>
>frmMyForm.grdGrid1.SetAll("DynamicBackColor", ;
>   "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;
>   , RGB(0,255,0))", "Column")
>
>
>If I change the controlling order of the underlying table however, it obviously won't work.
>
>How do I maintain the alternating backcolor even with different controlling order?
>
>Thanks in advance,
>
>Dennis

Hello Dennis:
If you are willing to use a cursor and are using VFP9, how about the following example. Works just great:
Create the cursor after you have set the index:
****Grid.INIT()
Select customer
Set Order To Tag custno
Select customer.*, Cast(Iif(Mod(Recno(),2) =0,.T.,.F.) As l) As test ;
FROM customer ;
WITH (Buffering = .T.) ;
Into Cursor gtest
With This
.RecordSource = "gtest"
.RecordSourceType = 1
.SetAll("DynamicBackColor", ;
"IIF(gtest.test, RGB(255,255,255) , RGB(0,255,0))", "Column")
Endwith
You will have to fine tune to suit your needs.

Mohammed
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform