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 & HelpPrograms › Need help with own program
Page Index Toggle Pages: 1
Need help with own program (Read 1491 times)
Need help with own program
Feb 7th, 2010, 11:44am
 
Hello everyone!

I'm learning Progressing in the moment and I want to create my own program. But now I have a problem and I hope you can help me.

Background information:
I have several programs with time relation. In every program text is showed during a  defined time period (here: one minute). For example: It is 20 o' clock and only by this time the text is showed.

And this is my problem:
At the end of the program, when the last time period was run, I want to close the program with the reference close() and then a new program with the next time periods should be opened. But I don't know how I could define this?! Is it only possible to open a new program manual or are there possibilities to do this automatically?

Thank you for help!

Greetings,
HaukeH
Re: Need help with own program
Reply #1 - Feb 7th, 2010, 12:03pm
 
There are several threads about this problem.
I think the best is to avoid closing and running a new instance, but to switch logic instead.
I shown an example in the Sequencing, display update, and functions  thread, for example.
Re: Need help with own program
Reply #2 - Feb 7th, 2010, 1:03pm
 
Okay, thanks!
I will try it.
Re: Need help with own program
Reply #3 - Feb 8th, 2010, 11:55am
 
I think this would make my program overflowed because the text I want to display is already very long.

Maybe it is possible that Processing can load a database with my text und then display?

Re: Need help with own program
Reply #4 - Feb 8th, 2010, 12:55pm
 
Yes.
Sorry to cite mostly my own programs, but I know them best! Smiley
arraylist with mysql shows how to access MySQL database.
Re: Need help with own program
Reply #5 - Feb 9th, 2010, 11:04am
 
Okay...
Sorry, that I don't understand anything because I'm only a beginner.  Embarrassed
So can you please only write down what references or functions I need and how I can create a database. Do I have to write a txt.-data? If yes, how do I write this? Are there any special forms I have to follow?

Sorry again...  Sad
Re: Need help with own program
Reply #6 - Feb 10th, 2010, 5:11am
 
OK, the term "database" was misleading.
You just need a data file to load, I doubt your text would be long enough to cause memory overflow...

Look at loadStrings(), it allows you to load lines from a text file in an array, then you can display them in various ways.
You can use also split() if you need to put several information per line (eg. hour and text).
Re: Need help with own program
Reply #7 - Feb 11th, 2010, 12:13pm
 
Well, I have understood (a progress!  Grin).

But can you please say, whether the text could be displayed with "println()" in the window which opens when you execute "Run" (I don't know what its name is...), too?

Another question: How can I display the various lists I create with "split()" ?

After that I would be very happy and grateful!
Re: Need help with own program
Reply #8 - Feb 11th, 2010, 12:27pm
 
println() is only to display (debug) stuff on the console.
To display text on the sketch's surface, use text().
And split() returns an Array of Strings, you just access the one you need and use it in text().
Re: Need help with own program
Reply #9 - Feb 12th, 2010, 5:09pm
 
Okay, it works.
Thank you very much!

Nice greetings,
HaukeH
Page Index Toggle Pages: 1