Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display description in a grid column rather than code
Message
De
02/04/2001 11:54:04
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00490488
Message ID:
00490956
Vues:
8
>>>The problem here, that I don't have code+description as a separate table. I created an include file, where I set variables, like APNEDT "E", etc. I was thinking, is it possible to set controlsource like iif(APNEDT,APNEDTDESC,...). Since there are ~5 different values, it would not be convenient to use iif, it's better to use some function here. My question is: could it be done?
>>
>>You could set a function as the controlsource of a textbox, which would have that one-char field as a parameter, and return the string.
>
>Could it be a form method? E.g. in properties ControlSource put something like:
>thisform.GetDescription(APN)?


As others have pointed out, you're better off using a .prg, either having a function or class definition there. The point is, each of the cells in the visible part of the grid is refreshed for each refresh of the grid (just try to have a function call in the BackColor property and see how many times it fires), and running method code may introduce too much overhead. One thing you can't be sure is the meaning of 'this' in such a code - what is the context the dynamic stuff in cell properties is evaluated in. 'Thisform' as a context reference may work - this is still within a grid on a form, not an OKL or menu call, so the form should be available.

I think Charlie's solution would be the best - to work with a cursor or view where these values would be replaced with their textual counterparts. If you don't want to change the structure of the table your grid is based on, you can still create a separate cursor with just the one-char column and the description column, have it indexed on the first column, and have a relation into it from the grid, i.e. just create a simple lookup.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform