Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing row colour of grid based on condition
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01531331
Message ID:
01531346
Vues:
35
>>>>>>>My grid is driven by a table called collections
>>>>>>>
>>>>>>>If the service column of any record contains any one of the following I want that row to be black, otherwise red
>>>>>>>
>>>>>>>STANDARD
>>>>>>>ECONOMY SERVICE
>>>>>>>STANDARD (EXPRESS)
>>>>>>>ECONOMY
>>>>>>>
>>>>>>>and where do I put the relevant code?
>>>>>>
>>>>>>
>>>>>>*** Init event of the Form
>>>>>>
>>>>>>thisform.GridObject.SetAll("DynamicForeColor","thisform.SetGridColor()","Column")
>>>>>>
>>>>>>
>>>>>>*** Add a new method in the form called SetGridColor
>>>>>>*** In it:
>>>>>>lnRetColor = RGB(0,0,0) && Black
>>>>>>IF UPPER(ALLTRIM(GridTable.ServiceColumn)) == "STANDARD"           OR;
>>>>>>   UPPER(ALLTRIM(GridTable.ServiceColumn)) == "ECONOMY SERVICE"    OR;
>>>>>>   UPPER(ALLTRIM(GridTable.ServiceColumn)) == "STANDARD (EXPRESS)" OR;
>>>>>>   UPPER(ALLTRIM(GridTable.ServiceColumn)) == "ECONOMY"
>>>>>>   lnRetColor = RGB(255,0,0) && Red
>>>>>>ENDIF
>>>>>>
>>>>>>RETURN m.lnRetColor
>>>>>>
>>>>>>I made it as a method, because if tomorrow you (your client) decide to have different colors for different Services to be much easier :-)
>>>>>
>>>>>Boris
>>>>>
>>>>>I get unknown member gridobject when the form loads
>>>>>
>>>>>Colin
>>>>
>>>>
>>>>GridObject -> this should be the real name of the grid. Something like thisform.Grid1 or Thsiform.Container1.Grid1 ...
>>>>I don't know this real name of the grid, that is why I used some name :-)
>>>
>>>of course - grid 1
>>>
>>>bit it's setting the backcolor not the forcolor - see my second post
>>>
>>>Thanks
>>
>>No way.
>>When you use DynamicForeColor the ForeColor will be changed.
>
>Sorry I meant it's changing back AND fore colors

Correction only the back - how do I set up dynamicforecolor - i copied what you wrote
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform