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 & HelpIntegration › send to processing embedded
Page Index Toggle Pages: 1
send to processing embedded (Read 3325 times)
send to processing embedded
Mar 3rd, 2007, 10:21pm
 
Hello,

Please someone help me...
I tried to embed Processing in Frame and it works really fine, like explaied in doc
http://dev.processing.org/reference/core/javadoc/processing/core/PApplet.html

My problem is that I don't know how to talk to my Embedded processing...

I created Embedded processing like this:
PApplet myProc = new Embedded();

So how can I access Embedded from this situation and send him some values?

thanx for help,
uki

Re: send to processing embedded
Reply #1 - Mar 4th, 2007, 12:11pm
 
several ways to do that:

myProc.frameRate; // read framerate
myProc.frameRate(10); // set framerate

if your embedded had a method like:
public void myMethod ( String _str )
{
 // do something with _str here ..
}
you could do:
myProc.myMethod("something"); // call a method inside myProc (has to be public)

another way is to share objects, for example:

String testString = "abc";
myProc.myString = testString;

so now myProc could write the string to the screen inside draw() for example.

have a look at how to write libraries to see how to register handlers:
http://dev.processing.org/libraries/

hope this get's you started ...
F
Re: send to processing embedded
Reply #2 - Mar 4th, 2007, 11:56pm
 
I tried that already and it didn't work! I thought that I'm crazy. He cannot access any of my methods in class! Simply don't see them.

After some experimenting I changed declaration from:

PApplet myProc = new Embedded();

to

Embedded myProc = new Embedded();

and now it works! Maybe, error in documentation?


thanks for your clarifications,
best,
uki





Re: send to processing embedded
Reply #3 - Mar 5th, 2007, 4:27pm
 
no, not an error in documentation. if you want to use PApplet methods then the object can be a PApplet. if you want to use methods from your object, then the PApplet has to be of that same type.

if you're going to use eclipse instead of the processing environment, i strongly recommend that you get a java book to study, which will cover this sort of thing.
Page Index Toggle Pages: 1