Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding Color to grid/table browse based on value in a co
Message
From
18/05/2005 09:21:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/05/2005 09:05:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01015292
Message ID:
01015303
Views:
29
This message has been marked as the solution to the initial question of the thread.
>Just wondering... is there a way to "color" rows when I'm browsing a table with an index set to one of the field's value? For example, I might have the following records in a table:
>
>Name__________________Item
>Laura Morgan....................basket
>Laura Morgan....................perfume
>Dave Jeffries......................tool set
>Dave Jeffries......................tennis balls
>Dave Jeffries......................golf club bag
>Ann Crouch.......................picture frame
>Pam Boyce.......................decorative soaps
>Linda Hopper.....................paint set
>Linda Hopper.....................table lamp
>
>I would want Laura's rows to be white, Dave's rows to be blue, Ann's row to be white, Pam's row to be blue, Linda's rows to be white, etc.
>
>Is this possible?
>
>Thanks,
>
>Alicia Bay for Joe Pawlowski
SetAll('DynamicBackColor' ;
"iif(myTable.Name = 'Laura Morgan', 0xFFFFFF, "+;
"iif(myTable.Name = 'Dave Jeffries', 0xFF0000, "+;
...)
However you can see how complex it might get quickly. Instead you might create a method that'd return you the color. Then setall() looks like:
SetAll('DynamicBackColor',"(thisform.GimmeColor(myTable.Name))")
In GimmeColor you can check the name and return the color you want. Yet another easy way would be to have an array or cursor to supply colors. ie:
select distinct name, 0xFFFFFF as Color from myTable into cursor myColors readwrite
browse && fill the colors
index on name tag name
select myTable
set relation to name into myColors
SetAll('DynamicBackColor',"(myColors.Color)")
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