Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display description in a grid column rather than code
Message
 
 
To
02/04/2001 11:54:04
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00490488
Message ID:
00490958
Views:
10
>>>>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.

Dragan,

Thanks for the excellent explanation. I'll see, what I can do here...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform