Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ABS() coding assistance???
Message
 
 
To
24/08/2001 11:57:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00548379
Message ID:
00548739
Views:
8
>>>It already works for me. I have a generic one-column grid for displaying names, and it's based on a cursor with several columns more - crcolor i, crbold l, critalic l - and .column1.dynamicbackcolor='alias.crcolor', and it goes the same for .dynamicfontbold and .dynamicfontitalic. The trick is to pre-fill the .crcolor with 0x00ffffff (white) initially, and then pick different color numbers to color the records. This is the fastest coloring trick I've found so far, since it calculates nothing - it just takes the color number from another field in the same record. True, the pre-fill does take some time, but then the values are calculated only once, and not upon each grid.refresh.
>>
>>What should be crColor? Should it be Integer rgb(255,255,255) or it should be something different? If yes, what should be format and how can I convert values to this format?
>
>Try
>?0x00ffffff
>?rgb(255,255,255)
>and you will get the same number; I store it as integer.
>
>The fastest you can do (since you don't have millions of different colors, only a few):
>
>
select distinct your_field from your_table into array diffval
>for i=1 to alen(diffval)
>   nValue=diffval[i]
>   nColor=this.mycolor(nValue)
>   replace (colorfield) with nColor for your_field=nValue
>endfor
>this.grid1.column1.dynamicforecolor='your_table.colorfield'
>
>You should run this in grid's init or form's load. Not sure about the sparse setting; in the case which initiated this thread, I tried with an additional column which contained the input mask, set the dynamicinputmask to the name of that field, and it worked with sparse=.f., otherwise it changed inputmasks as you moved up and down.

Hi Dragan,

I added a new field in my addition lookup table AddrStat custColor. I made it integer and put 0, 255, etc. colors respectively (this table has only 8 records). In my main form I set relation to this table based on the status field. In the grid I added this.setall('DynamicForeColor','AddrStat.CustColor') and it worked like a charm!!!!!

Thanks a million! Too bad, I hadn't started this thread...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform