We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › global variables and tabs
Page Index Toggle Pages: 1
global variables and tabs (Read 778 times)
global variables and tabs
Dec 24th, 2006, 7:47pm
 
Hi

im using an applet with some variables, which a nested class human uses. Now i wanted to put the human class in a tab, and i thought that that would simply be a copy paste matter, since tabs are treated as nested classes, right?
when i try to run the program however, problems immediately pop up about variables which cannot be found.

the program looks something like this:

public class name{

 int bla;

 setup(){
   Human d = new Human();
 }

 class Human{
 // constructor and functions accessing bla
 }
}

shouldnt it just work if i put the Human class in the tab, or am i missing something?
Re: global variables and tabs
Reply #1 - Dec 24th, 2006, 10:48pm
 
new tabs are just seperate views of a single file (effectively) so something in a differetn tab acts the same as if it was just appended on to the main pde file.
So in your case, Human is a top level class just like your first class, NOT as a child class of the first one.
Re: global variables and tabs
Reply #2 - Dec 25th, 2006, 12:09pm
 
thanks, that worked perfectly:)
Page Index Toggle Pages: 1