Post by StefanPendl on Mar 1, 2009 4:29:17 GMT -5
RBP v1.0.1 Build 2.44:
RB returns an error, when using the RUN command twice in a row inside a SUB.
Following three projects will illustrate this:
DefaultVarsParent
DefaultVarsChild
DefaultVarsChildFunction
The output will be:
Seems that something is erasing the global variables.
RB returns an error, when using the RUN command twice in a row inside a SUB.
Following three projects will illustrate this:
DefaultVarsParent
print "Parent"
print "DefaultDir$ ...... "; DefaultDir$
print "Platform$ ........ "; Platform$
print "UserInfo$ ........ "; UserInfo$
print "UrlKeys$ ......... "; UrlKeys$
print "UserAddress$ ..... "; UserAddress$
print "ProjectsRoot$ .... "; ProjectsRoot$
print "ResourcesRoot$ ... "; ResourcesRoot$
print "Err$ ............. "; Err$
print "Err .............. "; Err
print "EventKey$ ........ "; EventKey$
print "RowIndex ......... "; RowIndex
html "<hr/>"
run ProjectsRoot$ + "\DefaultVarsChild_project\DefaultVarsChild.bas", #child
render #child
html "<hr/>"
run ProjectsRoot$ + "\DefaultVarsChildFunction_project\DefaultVarsChildFunction.bas", #childFunct
#childFunct initVars(#self)
#childFunct display()
render #childFunct
call ShowDefaults
end
function GetIP$()
GetIP$ = UserAddress$
end function
sub ShowDefaults
html "<hr/>"
html "<hr/>"
print "Inside SUB"
run ProjectsRoot$ + "\DefaultVarsChild_project\DefaultVarsChild.bas", #child
render #child
html "<hr/>"
run ProjectsRoot$ + "\DefaultVarsChildFunction_project\DefaultVarsChildFunction.bas", #childFunct
#childFunct initVars(#self)
#childFunct display()
render #childFunct
end sub
DefaultVarsChild
print "Child"
print "DefaultDir$ ...... "; DefaultDir$
print "Platform$ ........ "; Platform$
print "UserInfo$ ........ "; UserInfo$
print "UrlKeys$ ......... "; UrlKeys$
print "UserAddress$ ..... "; UserAddress$
print "ProjectsRoot$ .... "; ProjectsRoot$
print "ResourcesRoot$ ... "; ResourcesRoot$
print "Err$ ............. "; Err$
print "Err .............. "; Err
print "EventKey$ ........ "; EventKey$
print "RowIndex ......... "; RowIndex
wait
DefaultVarsChildFunction
function display()
print "Child Function"
print "DefaultDir$ ...... "; DefaultDir$
print "Platform$ ........ "; Platform$
print "UserInfo$ ........ "; UserInfo$
print "UrlKeys$ ......... "; UrlKeys$
print "UserAddress$ ..... "; UserAddress$
print "ProjectsRoot$ .... "; ProjectsRoot$
print "ResourcesRoot$ ... "; ResourcesRoot$
print "Err$ ............. "; Err$
print "Err .............. "; Err
print "EventKey$ ........ "; EventKey$
print "RowIndex ......... "; RowIndex
end function
function initVars(#parent)
UserAddress$ = #parent GetIP$()
end function
The output will be:
Parent
DefaultDir$ ...... c:\Shoptalk Systems\Run BASIC Free Edition 1.01
Platform$ ........ win32
UserInfo$ ........ Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
UrlKeys$ .........
UserAddress$ ..... 127.0.0.1
ProjectsRoot$ .... C:\Users\Stefan\Documents\Prog\Run BASIC
ResourcesRoot$ ... c:\Shoptalk Systems\Run BASIC Free Edition 1.01\public
Err$ .............
Err .............. 0
EventKey$ ........
RowIndex ......... 0
Child
DefaultDir$ ...... c:\Shoptalk Systems\Run BASIC Free Edition 1.01
Platform$ ........ win32
UserInfo$ ........ Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
UrlKeys$ .........
UserAddress$ ..... 127.0.0.1
ProjectsRoot$ .... C:\Users\Stefan\Documents\Prog\Run BASIC
ResourcesRoot$ ... c:\Shoptalk Systems\Run BASIC Free Edition 1.01\public
Err$ .............
Err .............. 0
EventKey$ ........
RowIndex ......... 0
Child Function
DefaultDir$ ...... c:\Shoptalk Systems\Run BASIC Free Edition 1.01
Platform$ ........ win32
UserInfo$ ........ Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
UrlKeys$ .........
UserAddress$ ..... 127.0.0.1
ProjectsRoot$ .... C:\Users\Stefan\Documents\Prog\Run BASIC
ResourcesRoot$ ... c:\Shoptalk Systems\Run BASIC Free Edition 1.01\public
Err$ .............
Err .............. 0
EventKey$ ........
RowIndex ......... 0
Inside SUB
Child
DefaultDir$ ...... c:\Shoptalk Systems\Run BASIC Free Edition 1.01
Platform$ ........ win32
UserInfo$ ........
UrlKeys$ .........
UserAddress$ .....
ProjectsRoot$ ....
ResourcesRoot$ ...
Err$ .............
Err .............. 0
EventKey$ ........
RowIndex ......... 0
Runtime Error in program 'DefaultVarsParent': run ProjectsRoot$ + "\DefaultVarsChildFunction_project\DefaultVarsChildFunction.bas", #childFunct
Project/module \DefaultVarsChildFunction_project\DefaultVarsChildFunction.bas not found.
Seems that something is erasing the global variables.