General information
Category:
Coding, syntax & commands
Cindy-
>To go a little further with what Nancy said, any variable initialized in the Main program is seen throughout the application by default, and it need not be specified as "global."
That's an aside. But, yes, it's correct. That's because it (an otherwise undeclared variable) is a private and visible to all child procedures, which is everything from the MAIN.PRG and down. I dislike globals (except for an app object), but if one is going to use them in concept, I like it when a program declares them so. It helps make intent explicit. And, of course, one might use GLOBAL to keep the functionality in the case of an architecture change.
>Some developers use an Application Object (oApp) which holds all the "variables" as properties. You could initialize the oApp in the Main program and when the user identifies himself, pick up the properties and assign them to oApp.
A much better approach to globals, of course, in that it consolidates the global variables in one object. I hope that Claude considers it. I read his post to say he wanted to keep his globals but set them from a table instead of, on assumes, programmatically hardcoded.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only