Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using function result for source in grid column
Message
De
08/11/1999 21:02:18
 
 
À
08/11/1999 11:59:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00288477
Message ID:
00288824
Vues:
22
>I am using the results generated from a function as the control source for a column in a grid. The grid displays the correct values but when I scroll the grid while positioned on any field the behavior is very erractic (movement among records is difficult) plus the calculated field (one using the function as source) is sometimes highlighted. When I use the vertical scroll bar everything seems okay but the moment I give focus to any column field I get the funky behavior. The function code is listed below I would appreciate any help to alleviate this situation.
>
>FUNCTION get_stat
>PRIVATE PASS
>PASS = SPACE(10)
>
>SELECT REMAIN
>SET ORDER TO MOI
>
>RMN = .F.
>IF SEEK(AMBORD.MILLORDER + AMBORD.ITEM)
> RMN = .T.
>ENDIF
>
>SELECT AMBORD
>
>IF AMBORD.LOADIND = 'Y'
> IF RMN
> PASS = '**LOADED'
> ELSE
> PASS = 'LOADED'
> ENDIF
>ENDIF
>
>IF AMBORD.LOADIND = ' '
> IF RMN
> PASS = '**UNLOADED'
> ELSE
> PASS = 'UNLOADED'
> ENDIF
>ENDIF
>
>IF NOT EMPTY(AMBORD.ASHIPDATE)
> SET CENTURY OFF
> IF RMN
> PASS = '**' + DTOC(AMBORD.ASHIPDATE)
> ELSE
> PASS = 'C ' + DTOC(AMBORD.ASHIPDATE)
> ENDIF
> SET CENTURY ON
>ENDIF
>
>IF LEFT(AMBORD.MILLORDER,1) = 'X' AND AMBROD.LOADIND = ' '
> PASS = 'BY ' + LEFT(AMBORD.RECV_BY,5)
>ENDIF
>
>IF LEFT(AMBORD.MILLORDER,1) = 'X' AND AMBORD.LOADIND = 'Y'
> PASS = 'LD ' + LEFT(RECV_BY,5)
>ENDIF
>
>RETURN PASS

Usually, calculated controlsource works fast. You may improve code by some simple means:
1) Do not SELECT REMAIN. SEEK() will do all job, it does not require work area to be selected. I assume here that Grid.Recordsource='ambord'
2) Use LOCAL Pass
3) When you calculated PASS once you may immediately RETURN PASS (if I understood your logics correctly). There is no much good in recalculating/overriding the same variable many times.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform