This is in the init of the grid
.SetAll("DynamicBackColor", ;
"IIF(RECNO(THIS.RecordSource) = THIS.ncurrentrecord," + ;
"THIS.gridactivebackcolor," + ;
"IIF(vtank.cur_ostat = 'S'," + ;
"RGB(0,255,0)," + ;
"IIF(vtank.cur_ostat = 'A'," + ;
"RGB(0,200,0)," + ;
"IIF(vtank.cur_ostat = 'D'," + ;
"RGB(0,128,0)," + ;
"IIF(vtank.cur_ostat ='W'," + ;
"RGB(255,0,0)," + ;
"IIF(vtank.cur_ostat = 'C'," + ;
"RGB(0,0,255)," + ;
"THIS.griddefaultbackcolor))))))", ;
"COLUMN")
This colors the rows in a grid based on order status. ;^)
Jeff
---------------
Jeff Johnson
[email protected]
(623) 582-0323
www.san-dc.com
On 09/22/2010 11:12 AM, Tina Currie wrote:
> How did I not know about ICASE() ???
>
> Thanks - will give it a go.
>
> Tina
>
>
> -----Original Message-----
> From: Fred Taylor [mailto:[email protected]]
> Sent: Thursday, 23 September 2010 3:07 AM
> To: ProFox Email List
> Subject: Re: Change the colour of rows in a grid based on data
>
> Also, another option may be you can use the ICASE function for
> multiple cases in your SetAll if you're using VFP9.
>
> Fred
>
>
>
> On Wed, Sep 22, 2010 at 9:48 AM, Tina Currie<[email protected]> wrote:
>
>> Hi all,
>>
>>
>>
>> I'm displaying a grid of some stuff the user wants to see from a search
>> screen. They put in the criteria and it selects to a cursor. Based on a
>> status field in the data, I want to colour code each line in the grid so
>> they can easily see which jobs are at which status.
>>
>>
>>
>> I've done this before when I was checking only one field and changed it
>> based on whether that field was true or false. Code worked a treat and
>> looked like this:
>>
>>
>>
>>
>>
> thisform.Grid1.SetAll("DynamicBackColor","IIF(offhired=.t.,RGB(2,136,200),RG
>
>> B(255,255,255))", "Column")
>>
>>
>>
> thisform.Grid1.SetAll("DynamicForeColor","IIF(offhired=.t.,RGB(255,255,255),
>
>> RGB(0,0,0))", "Column")
>>
>>
>>
>> Now the field I want query has 3 possible status codes and I want a
>> different colour row for each one. I've tried the following with no joy:
>>
>>
>>
>> SELECT CurSearchResults&& the cursor I selected into
>>
>> SCAN
>>
>> DO CASE
>>
>> CASE SearchByClient.status = '00'&& To Be Allocated
>>
>>
>> thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status =
>> '00',RGB(2,136,200),RGB(255,255,255)", "Column")
>>
>>
>> thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status =
>> '00',RGB(255,255,255),RGB(0,0,0)", "Column")
>>
>>
>>
>> CASE SearchByClient.status = '10'&& Allocated
>>
>>
>> thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status =
>> '10',RGB(128,255,0),RGB(255,255,255)", "Column")
>>
>>
>> thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status =
>> '10',RGB(255,255,255),RGB(0,0,0)", "Column")
>>
>>
>>
>> CASE SearchByClient.status = '20'&& To Be Invoiced
>>
>>
>> thisform.Grid1.SetAll("DynamicBackColor","iif(CurSearchResults.status =
>> '20',RGB(145,0,72),RGB(255,255,255)", "Column")
>>
>>
>> thisform.Grid1.SetAll("DynamicForeColor","iif(CurSearchResults.status =
>> '20',RGB(255,255,255),RGB(0,0,0)", "Column")
>>
>> ENDCASE
>>
>> ENDSCAN
>>
>>
>>
>> This code makes all lines in the grid blue, regardless of status. Is it
>> because I'm using SetAll? What am I missing and is what I want to do even
>> possible?
>>
>> It's 2:45am here in Australia and this one kept me awake so I thought I'd
>> get up and deal with it....
>>
>>
>>
>> TIA,
>>
>>
>>
>> Tina
>>
>>
>>
>> --- StripMime Report -- processed MIME parts ---
>> multipart/alternative
>> text/plain (text body -- kept)
>> text/html
>> ---
>>
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.