I am having issues with what appears to be failing PUBLIC variables. I have read many threads over the last couple of days but none yet that seems to catch my problem - everything seems to be in place.
Initially, I started with a simple PUBLIC declaration followed by assigning values to two variables within the MAIN program (SNMain.prg). These are placed after all the SETs but before anything else - definitely before READ EVENTS.
PUBLIC gcUserProfile, gcProfileName
gcUserProfile = GETENV("USERPROFILE")
gcProfileName = UPPER(RIGHT(gcUserProfile, LEN(gcUserProfile) - tnCalculated_Number))
I know the two variables load correctly as they are used further on within SNMain. However, the first form called by SNMain declares that they are 'Variable not found'. To make absolutely sure I hadn't done anything dumb somewhere in the depths of the form's methods which was dumping the variables, I added a couple of lines right at the top of the INIT.
tnTemp1 = gcUserProfile
tnTemp2 = gcProfileName
The two Publics are already gone before these lines.
Next, I replaced the variable definition section with the following
PUBLIC oGV, gcUserProfile, gcProfileName
oGV = NEWOBJECT("snGlobals", "snClassLib")
The class, snGlobals, sets the two Public variables and, as before, these are available within SNMain - but not elsewhere. This is not different, of course, to what I did initially - just a different way of achieving it!
Whilst I still have some hair left, I would be really grateful if someone could point out what obvious thing I'm missing?
Initially, I started with a simple PUBLIC declaration followed by assigning values to two variables within the MAIN program (SNMain.prg). These are placed after all the SETs but before anything else - definitely before READ EVENTS.
PUBLIC gcUserProfile, gcProfileName
gcUserProfile = GETENV("USERPROFILE")
gcProfileName = UPPER(RIGHT(gcUserProfile, LEN(gcUserProfile) - tnCalculated_Number))
I know the two variables load correctly as they are used further on within SNMain. However, the first form called by SNMain declares that they are 'Variable not found'. To make absolutely sure I hadn't done anything dumb somewhere in the depths of the form's methods which was dumping the variables, I added a couple of lines right at the top of the INIT.
tnTemp1 = gcUserProfile
tnTemp2 = gcProfileName
The two Publics are already gone before these lines.
Next, I replaced the variable definition section with the following
PUBLIC oGV, gcUserProfile, gcProfileName
oGV = NEWOBJECT("snGlobals", "snClassLib")
The class, snGlobals, sets the two Public variables and, as before, these are available within SNMain - but not elsewhere. This is not different, of course, to what I did initially - just a different way of achieving it!
Whilst I still have some hair left, I would be really grateful if someone could point out what obvious thing I'm missing?