Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DynamicBackColor and This.Parent....
Message
From
04/08/1999 05:49:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/08/1999 14:36:16
Kenneth Downs
Secure Data Software, Inc.
New York, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00249356
Message ID:
00249616
Views:
24
>Is it me, or is it VFP?
>
>When assigning the DynamicBackColor for columns, This.Parent refers to the grid's parent, not the grid. Drove me crazy until I figured it out.
>
>Does anyone know if MS has an opinion on this?
Kenneth,
It's the case with all Dynamic* properties. It has pros and cons. ie:
this.setall("DynamicBackColor","iif(recno(this.recordsource)%2=0,256^3,256^2)","Column") is legal and I love being to able to use this.recordsource :)
OTOH when you have a need to set things based on belonging column things get screwy. Still you could do it at grid level :
this.SetAll("DynamicBackColor", ;
 "iif(recno(this.recordsource) = this.nCurRec or " +;
 "this.activecolumn > 0 and this.columns(this.activecolumn).controlsource "+;
 "= lower(this.recordsource+'.'+varread()), 256^2-1,256^3-1)","Column")
Puts a "crosshair" highlight (highlights both row and col of current cell).
But we can't live with things so complex all the time. Whenever you have a need delegate the expression to a method. ie: Another coloring scheme for grid cells :
for each oColumn in ThisForm.Grid1.columns
 oColumn.DynamicBackColor = "GimmeColor("+oColumn.Controlsource+")"
endfor
ThisForm.Grid1.refresh
This is indiviual setting. Your gimmecolor() method would decide color based on controlsource. Since Dynamic* is evaluated for all visible cells after each grid.refresh you could base your colors on controlsource values easily (ie: 12 different colors for date values depending on month).
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
Next
Reply
Map
View

Click here to load this message in the networking platform