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 › processing.core.PApplet parent
Page Index Toggle Pages: 1
processing.core.PApplet parent? (Read 334 times)
processing.core.PApplet parent?
Jul 9th, 2009, 6:07am
 
hi, what does it means processing.core.PApplet parent? i want to create an object from glmodel class as a atribute of a another class made by me.  If i want to create an object from glmodel class i need to do something like this: modulo =  new GLModel(this, 4*numPoints, LINES, GLModel.DYNAMIC );

but when i try to create as an attribute of a new class, the "this" doesnt work  , it seems because this is a reserved word. Any idea ?

this is the constructor detail :
public GLModel(processing.core.PApplet parent,
              int numVert,
              int mode,
              int usage)


thanks
Re: processing.core.PApplet parent?
Reply #1 - Jul 9th, 2009, 7:05am
 
That's the this of the main class.
If you need to access it from a sub-class, you can:
- Pass it as parameter (eg. in the constructor);
- Get it as this.getClass().getEnclosingClass();
- Or just use: <sketch name>.this
Page Index Toggle Pages: 1