Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetFldState and Alias not found troubles
Message
 
À
22/10/1997 07:57:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00055703
Message ID:
00056120
Vues:
51
>> IF TYPE("_screen.activeform.ActiveControl.Name") = "C"
>> _screen.activeform.ActiveControl.SetFocus()
>> ENDIF

>IF GETFLDSTATE(0) % 2 = 1 AND TYPE("THISFORM.ActiveControl") == "O" AND ;
> UPPER(THISFORM.ActiveControl.BaseClass) <> "GRID"
> IF TYPE("THISFORM.ActiveControl.ControlSource") <> "U" AND ;
> !EMPTY(THISFORM.ActiveControl.ControlSource)
> IF EVAL(THISFORM.ActiveControl.ControlSource) <> THISFORM.ActiveControl.Value
> REPLACE (THISFORM.ActiveControl.ControlSource) WITH THISFORM.ActiveControl.Value
> IF ALLTRIM(EVAL(THISFORM.ActiveControl.ControlSource)) = ALLTRIM(THISFORM.ActiveControl.Value)
> llRetVal = .T.
> ELSE
> llRetVal = .F.
> ENDIF
> ENDIF
> ENDIF
>ENDIF

Marcia,

Three lines of code versus 12 lines <g>. Also TYPE("Blah") = "O" is not a full check for an object, the var may be type O and be value NULL, in this case you other checks would error. This is why I check TYPE("Blah.Name") = "C", because Blah may be type O and value is NULL but Blah.Name will only be type C if the object exists. Also your code will do a replace on the field, but the control will also update the field again when it loses focus. GetFldState will become dirty even if you replace the field with the same value it already has.

As for the THIS.Value = File.Field, that line dirties the buffer.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform