Re: variable scope problem?



I believe the problem is that you're trying to access those variables
from within a function. Variables defined in include files should be
accessible to anything after the declaration (think of several include
files as one giant file, in a way). Functions are the only except,
really.

On the first line of your function add:

global $KTPTTopColor, $KTPTBlue, $KTPTRed;

this should allow your global variables to be accessible from within
the function.

.



Relevant Pages

  • Re: Declarative loops and list comprehensions
    ... You have to either declare local variables or global variables. ... both inside and outside the loop. ... A compiler, having a global view of the clause, could figure this ... that's why the paramdeclaration seems silly. ...
    (comp.lang.prolog)
  • Re: Declarative loops and list comprehensions
    ... You have to either declare local variables or global variables. ... both inside and outside the loop. ... that's why the paramdeclaration seems silly. ... You simply treat X as a term that is shared between iterations, ...
    (comp.lang.prolog)
  • Re: Declarative loops and list comprehensions
    ... You have to either declare local variables or global variables. ... If you compile everything as is done in ECLiPSe, ... Adding an extra operator declaration is no problem, ... This notation is better than other ...
    (comp.lang.prolog)
  • Re: How do you declare a Global Variable in VC++6
    ... I would never consider putting such a declaration in the app file. ... extern CString MyStringEveryoneUses; ... The few times I use global variables, this is the approach I use. ... That way the string is only assigned once. ...
    (microsoft.public.vc.mfc)
  • Re: Best Way to Define/Declare/Initialize Variables Simultaneously?
    ... >> Is there a neater and more compact way to handle the initializers ... declaration still need further investigation, ... If you've got a lot of global variables lying ... pretty much for the reasons given in the above paragraph. ...
    (comp.lang.cpp)