Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memory Variable and Local Variable....
Message
De
05/10/1998 01:23:31
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Memory Variable and Local Variable....
Divers
Thread ID:
00143781
Message ID:
00143781
Vues:
68
we can 'Use' a variable with/without declaration.

e.g. we can:

abc = dtos(date())
Messagebox(abc)

or

Local abc
abc = dtos(date())
Messagebox(abc)

or

Local abc
abc = dtos(date())
Messagebox(m.abc)




What is the different between abc and m.abc?!
What is the different on Declare Local or Not?!




For my observe, if using recusion without Local declaration,
problem will come out!

setAllFonts()
Lparameters SetObject, nFontsize

For iX = 1 to SetObject.Controlcount
if Pemstatus(SetObject.controls[iX], "Fontsize", 5)
SetObject.controls[iX].fontsize = nFontsize
endif

if Pemstatus(SetObject.controls[iX], "Controlcount", 5)
SetAllFonts(Object.controls[iX], nfontsize)
endif
EndFor

The problem comes in inner recusion as the iX variable will reset to 1 again but afterwards, when back to outer loop.
the iX variable may smaller than previous value!

This is because the variable still not out of scope!
but there will work fine if there is line:

Local iX && in the prg file! ^_^;




Another thing on Macros,

abc = Dtos(Date())
what are different on:

abc, (abc), &abc, (&abc), and also "&abc"

which should be used on value!?
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform