Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global mem vars -> global application properties?
Message
From
11/07/2001 09:54:01
 
 
To
10/07/2001 21:57:24
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00528711
Message ID:
00529102
Views:
13
What I am missing (because I never did in the past is how to create the global property, i.e. oApp.CurrentUser once I have oApp.

Thanks for replies

>>>I am working with an application that use global variables, i.e. public variables defined in the main program. I would like to replace them with equivalent application specific properties, i.e. properties that can be used anywhere in the application. Values for the properties would come from a table.
>>>
>>>Several examples.
>>>1, Name of current user, security level, etc.
>>>2. headings for reports, forms, etc.
>>>
>>>Questions
>>>1. Is it possible?
>>>2. If so how? Please supply sample code snippets.
>>
>>I suspect I'm missing something obvious. If you want to continue to use your global variables, then you'd simply
>>
>>USE yourSettingsTable
>>STORE TheReleventFields TO TheReleventPublicVariables
>>
>>Do I misunderstand your question?
>
>Claude,
>
>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."
>
>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.
>
>In the login form you'd have something like
>
SELECT UserTable
>LOCATE FOR UserTable.UserID = frmLogin.txtUserID.VALUE
>IF UserTable.Password <> frmLogin.txtPassword.VALUE
>    *!* Exit app
>ENDIF
>*!* Good to go
>oApp.CurrentUser = UserTable.UserID
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform