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 › Windows Clipboard and/or "InputBox" func
Page Index Toggle Pages: 1
Windows Clipboard and/or "InputBox" func (Read 916 times)
Windows Clipboard and/or "InputBox" func
Jul 11th, 2005, 7:42pm
 
Two questions:

1. Is there any easy way of interacting with the System Clipboard from a processing app? Especially images.  I suspect it's tough to get multiplatform with that so the answer is probably no.  (Which probably means I'll be using a lot of "print screen" to get the results of my program, ah well)

2. What's the easiest way to get the equivalent of a popup dialog?  Both VB and Javascript offer simple dialogs to accept one line of text that, while primitive looking, are easier than, you know, handling keypress and delete and/or repositioning of the cursor and all that.

Thanks!
Re: Windows Clipboard and/or "InputBox"
Reply #1 - Jul 13th, 2005, 5:40pm
 
And while I'm at it...you need to have a draw() function in order to do ANYTHING in, say, mouseDragged()? (In this case I wasn't drawing anything new, but wanted to diagnose some stuff w/ printlns... but nothing was happening til I added an empty draw routine...)
Re: Windows Clipboard and/or "InputBox"
Reply #2 - Jul 13th, 2005, 5:46pm
 
from the reference: "draw() must exist if you want the code to run continuously or to process events such as mousePressed()"
http://processing.org/reference/draw_.html

you can get the system clipboard using java's clipboard methods, i've gotten this to work for me well:
http://www.javaworld.com/javaworld/javatips/jw-javatip61.html

as for input boxes and whatnot.. you're on your own and would need to use regular java code to do it. also, you'll probably need to use something like SwingUtilities.invokeLater() or the SwingWorker class because if you do awt stuff inside of draw(), you may freeze the sketch.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/SwingUtilities.html
Re: Windows Clipboard and/or "InputBox"
Reply #3 - Jul 13th, 2005, 8:07pm
 
you also may want to take a look at Markavian's MyGUI library, its not completed, but it does have a one line text input box, and is very easy to use under processing, and you can add new compnents too, if you can figure out the way there made.
Re: Windows Clipboard and/or "InputBox"
Reply #4 - Jul 15th, 2005, 4:39pm
 
Aha, how to access the system clipboard from Java - I'll have no excuse for not including that feature in my text input now! (dang Smiley). Thanks Fry.

Edit: FYI. Early release of MyGUI library can be found at http://mkv25.net/MyGUI/
Page Index Toggle Pages: 1