Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Machine dependent color error with a grid
Message
From
24/02/2008 18:31:24
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01295947
Message ID:
01295972
Views:
16
>>>>>>I’m setting background colors in a grid so that some rows are a light green, and the rest are the normal white. It works fine on my machine (with an old simple screen card), but fails on my user’s newer machines. Here’s the code from the form’s Init():
>>>>>>
>>>>>>thisform.grdTheGarment.SetAll( ;
>>>>>>  "DynamicBackColor",;
>>>>>>  "iif(cType = 'L', rgb(225,255,226), rgb(255,255,255))",;
>>>>>>  "Column")
>>>>>>
>>>>>>The error message is in an Ok/Cancel messagebox, and says:
>>>>>>Expression is invalid. Use a valid
>>>>>>expression for DYNAMICBACKCOLOR
>>>>>>property.
>>>>>>
>>>>>>My user clicks on Ok 3 times, the messagebox disappears, and the form displays, but with a reported different green in the grid than requested. A separate textbox on the same form uses the same requested rgb(225,255,226) light green too, but shows the color correctly.
>>>>>>
>>>>>>Any thoughts?
>>>>>
>>>>>What is cType?
>>>>
>>>>lv_LocGarDef is the RecordSource for the grid. cType (lv_LocGarDef.cType) is one of the fields in the the grid's RecordSource.
>>>
>>>Then use the full qualified field name:
>>>
>>>thisform.grdTheGarment.SetAll([DynamicBackColor], [iif(lv_LocGarDef.cType = 'L', RGB(225,255,226), RGB(255,255,255))],[Column])
>>>
>>
>>It works the same (correct) way on my machine using either cType or lv_LocGarDef.cType so I haven't tried lv_LocGarDef.cType on the user machine (yet). It is now one of a few things that I can try. I'm also going to try some different "close" but diferent colors that are, say, multiples of 8 for the intermediate positions like RGB(224,255,224) instead of the curent RGB(225,255,226), and hopefully more likely to "exist" for me in that machine's color vocabulary. It feels unlikely that this will work, but I'll be trying it too.
>
>You could try with this:
>
>thisform.grdTheGarment.SetAll([DynamicBackColor], [iif(lv_LocGarDef.cType = 'L', RGB(0,255,0), RGB(255,255,255))],[Column])
>
>Are you sure that lv_LocGarDef.cType have the same type on your machine and on your client's one?
>What if:
>
>*** Create a method in the form named SetMyColors
>*** Then:
>
>thisform.grdTheGarment.SetAll([DynamicBackColor], [thisform.SetMyColors()],[Column])
>
>*** SetMyColors code
>LOCAL lnRetVal
>DO CASE
>   CASE TYPE([lv_LocGarDef.cType]) # [C]
>        *** Make it RED just to know if that your user has wrong type
>        lnRetVal = RGB(255,0,0)
>   CASE lv_LocGarDef.cType         = [L]
>        *** Make it Green, clear green w/o any shades
>         lnRetVal = RGB(0,255,0)
>OTHERWISE
>        ** White
>        lnRetVal = RGB(255,255,255)
>ENDCASE
>RETURN lnRetVal
>
>
>BTW if you use themes the White is not the best choice. maybe you should return Grid.BackColor

Good approach to reduce the possible variables. I have sent a fresh version to my user to try, but he hasn't replied yet (he's not at the office, but has a laptop at home with the same color problem that he can test his system with). When he replies (and if we still have a problem), I'll incorporate your idea into the next attempt. In any case, I will be getting back with the answer to this one once we get things working, or if we get some new clues.
Previous
Reply
Map
View

Click here to load this message in the networking platform