Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highlight all fields in a grid
Message
From
12/03/1998 10:22:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
12/03/1998 09:17:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00084134
Message ID:
00084160
Views:
29
>Below is a snippet of code that we use with grids.
>
>In the grid's AfterRowColChange() event:
>
>
>lnRecNo = RECNO()
>
>cExpr = "IIF(RECNO()=" + STR(lnRecNo) + ",RGB(0,0,128), IIF(" + STR(MOD(RECNO()
> ,2))+ "=0 AND" + STR(RECNO()) + "!=" + STR(lnRecNo)+ ",
> RGB(255,255,255),RGB(255,255,255)))"
>
>THIS.SetAll("DynamicBackColor", cExpr, "Column")
>
>cExpr = "IIF(RECNO()=" + STR(lnRecNo) + ",RGB(255,255,255),.F.)"
>
>THIS.SetAll("DynamicForeColor", cExpr, "Column")
>
>THIS.Refresh()
>
>GO lnRecNo
>
>THISFORM.Refresh()
>
>
>
>
>I hope this helps.
>
>BRIAN
Thanks Brian,
After seeing yours I realized my reply was faulty and corrected code also needs to keep a variable (no speed difference as I could test). Reducted your code a little bit to remove var necessity :
THIS.SetAll("DynamicBackColor", ;
	"IIF(RECNO()="+str(recno()) +  ;
	",RGB(0,0,128), str(this.backcolor))", "Column")

THIS.SetAll("DynamicForeColor", ;
	"IIF(RECNO()="+str(recno()) +",RGB(255,255,255),str(this.forecolor))", "Column")
this.refresh
But of course if a field value (or something like recno()%2) could be used it would be easier to have this just in "init" and call "this.refresh" here.
Cetin
Ç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