Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memory Variable and Local Variable....
Message
From
05/10/1998 01:23:31
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Memory Variable and Local Variable....
Miscellaneous
Thread ID:
00143781
Message ID:
00143781
Views:
66
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.
Next
Reply
Map
View

Click here to load this message in the networking platform