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.
IndexProcessing DevelopmentLibraries,  Tool Development › using thinlets with processing
Page Index Toggle Pages: 1
using thinlets with processing (Read 1493 times)
using thinlets with processing
Dec 31st, 2005, 4:52pm
 
Hi,


this is a fast hack to show how to use thinlets
with processing. there are many GUI related posts on this
forums, so i thought sharing this even if its nothing
special.

for a demo see:
http://rzserv2.fhnon.de/~lg016586/processing/ThinletDemo/index.html

the project as package:
http://rzserv2.fhnon.de/~lg016586/processing/ThinletDemo/ThinletDemo-001.zip

and the library (even if it is not a real library; just the
thinlet jar):
http://rzserv2.fhnon.de/~lg016586/processing/ThinletDemo/libraries.zip

as mentioned, nothing special, but maybe helpful for someone else.
Re: using thinlets with processing
Reply #1 - Jan 1st, 2006, 7:11pm
 
Last I recall, thinlet didn't do mouse event translation to custom widgets, so if you wanted to have any kind of direct interaction with the processing display a little more work needs to be done.

To get that working (although I haven't done this with processing, just thinlet+custom render display) I had to hack up thinlet a bit and a real "Widget" object.  It was pretty rudimentary, though, and only supported certain mouse input via a custom method:
Code:
public void handleMouseEvent(int x, int y, int clickcount,
boolean shiftdown, boolean controldown, boolean popuptrigger,
int id)


So I suggest that anyone interested in working with thinlet and processing take a little time to see how that works.
Re: using thinlets with processing
Reply #2 - Jan 2nd, 2006, 5:46pm
 
yes you're right. handling mouse and key events is a bit
more difficult. i haven't tested the events with thinlets
and processing, but passing the events from thinlet to
the PApplet should work with an simple eventhandler method
in the custom PThinlet. maybe something like:
Code:

protected void processEvent(AWTEvent e) {

super.processEvent(e);
if (e instanceof KeyEvent) {
parent.keyEvent = (KeyEvent) e;
parent.key = ((KeyEvent) e).getKeyChar();
parent.keyCode = ((KeyEvent) e).getKeyCode();

switch (e.getID()) {
case KeyEvent.KEY_PRESSED:
parent.keyPressed((KeyEvent) e);
break;
case KeyEvent.KEY_RELEASED:
parent.keyReleased((KeyEvent) e);
break;
case KeyEvent.KEY_TYPED:
parent.keyTyped((KeyEvent) e);
break;
}
}
}
Page Index Toggle Pages: 1