Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Color for highlighted row in grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00530979
Message ID:
00531662
Vues:
12
Thanks, Andrew. This works perfectly.

>Hi Joel,
>
>Here's a bit of really obtuse code that does exactly what you're after. Lisa Slater-Nicholls presented this at a conference in Sydney about 5 years ago. It uses the oft-forgotten fact that VFP populates colorscheme 15 (as well as 13 and 14) from the display properties colours, and then does some string manipulation to grab the RGB values from the RGBSCHEME() function. Get ready <g>:
>
this.setall("DynamicBackColor", "iif(recno() = this.nRecordNumber, EVAL('RGB(' + SUBSTR(RGBSCHEME(15, 6), ;
>  AT(',', RGBSCHEME(15, 6), 3) + 1)), EVAL('RGB(' + SUBSTR(RGBSCHEME(15, 2), AT(',', RGBSCHEME(15, 2), 3) + 1)))", ;
>  "Column")
>this.setall("DynamicForeColor", "iif(recno() = this.nRecordNumber, EVAL(LEFT(RGBSCHEME(15, 6), ;
>  AT(',', RGBSCHEME(15, 6), 3) - 1) + ')'), EVAL(LEFT(RGBSCHEME(15, 2), AT(',', RGBSCHEME(15, 2), 3) - 1) + ')'))", ;
>  "Column")
>
>This code sits in the init of one of my grid base classes and I haven't had to look at it for quite some time. RGBSCHEME() returns a string that's in the format "RGB(fcR, fcG, fcB, bcR, bcG, bcB)", so the code above grabs the backcolor for the selected items:
>
'RGB(' + SUBSTR(RGBSCHEME(15, 6),  AT(',', RGBSCHEME(15, 6), 3) + 1)
>which evaluates to "RGB(bcR, bcG, bcB)". It does the same for the other three RGB values (selected forecolor, unselected backcolor and unselected forecolor).
>
>From some investigations I'm doing at the moment, RGBSCHEME(15, 6) gets its values from the Selected Items display property, and RGBSCHEME(15,2) gets its values from changes to the Message Box and Window display properties. I'm planning to post the results of my investigations on the WIKI as soon as they're fully assembled.
>
>Cheers,
>
>Andrew
>
>>I am using the common technique of setting the DynamicBackColor and DynamicForeColor properties of all columns to highlight a row in a grid. I would like the color of the row to match the Windows Display Properties. I thought about adding a textbox as a property to the grid at runtime and getting the SelectedForeColor and SelectedBackColor properties from it. Is there a better way to do this, perhaps one that uses fewer clock cycles? I don't want to depend on a certain control being in a column.
>>
>>I noticed a different method mentioned on the ProFox list that uses a textbox to simulate highlighting the row instead of Dynamic color properties, but the download at leafe.com was corrupted. If someone wouldn't mind emailing this to me (jleach@mbs-intl.com), maybe I can kill two birds with one stone. Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform