Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox
Message
From
11/10/2002 08:19:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00709886
Message ID:
00710238
Views:
15
Hans,
The code I wrote sets the background color of all columns (hence row).
DynamicBackColor AFAIK exists in all versions of VFP. This is from VFP5 help as is (in index write DynamicBackColor) :

"Specifies the background and foreground colors of a Column object. The colors are re-evaluated at run time each time the Grid control is refreshed. Available at design time; read-write at run time.

Syntax

Column.DynamicBackColor[ = cExpression]
Column.DynamicForeColor[ = cExpression]

Settings

cExpression Specifies an expression in quotation marks that is re-evaluated at run time whenever the Grid control is refreshed. The run-time evaluation must result in a single color value.

Remarks

You can use the DynamicBackColor and DynamicForeColor properties to create special effects, such as displaying the odd-numbered rows in green and the even-numbered rows in gray."

Try this code :
oForm = createobject('myForm')
oForm.show
read events

define class myForm as form
  add object myGrid as grid with name='MyGrid'
  procedure load
  create cursor Test (balance i, myDate d)
  for ix = 1 to 1000
    insert into Test values (int(rand()*10000), date()-int(rand()*100))
  endfor
  locate
endproc
  procedure init
  this.myGrid.setall('DynamicBackColor', ;
    'iif(Test.Balance < 2000, rgb(0,255,255),rgb(255,255,255))')
endproc
  procedure queryunload
  clear events
endproc
enddefine
You might also want to look FoxyClasses sample download (follow link in signature). Most of the classes are compatible with VFP5.
Cetin

>Hello Cetin,
>
>if I understand correctly, the code you are proposing is to change the color of a column. What I want to do is to change the color of some rows that meet a certain condition.
>
>I tried your code (thisform.myGrid.SetAll('DynamicBackColor', 'iif(myAlias.Balance < 100, rgb(0,255,255),rgb(255,255,255))') ) but it did not work. I can't find the property "DynamicBackColor" in the help neither. Maybe this property does not exist in VFP 5.0 ??
>
>Greetings,
>
>Hans
Ç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