Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Grid dynamicforecolor
Message
From
30/04/1998 07:02:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00095887
Message ID:
00095916
Views:
30
>I have a grid populated with a cursor, and based on the value of the column control I want to change the forecolor of the column. For instance, if the value in row1 column1 is a negative integer, I want to show it in red and if row2 column1 is positive, show it black. I've played around with the dynamicforecolor, but no success. I end up changing all rows red or black regardless of the values. Is what I'm trying to do posible?
>
>Thanks!
>
>John :)
John,
As long as you can have a logical expression you can set any indiviual cell, column, row or whole grid to any color. When you have a general expression use it with setall, otherwise set column dyn..color indiviually :
*Grid.init - 
for ix = 1 to this.columncount
  with this.columns(ix)
    if type(.controlsource)$"NY"
	.DynamicForeColor = "iif("+.controlsource+;
			"<0,rgb(255,0,0),"+;
			"iif("+.controlsource+;
			">0,rgb(0,0,255),"+;
			"rgb(0,0,0)))"
    endif
  endwith
endfor
It's easier than setall and you get desired result.
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