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.
Page Index Toggle Pages: 1
text tree (Read 1185 times)
text tree
Oct 5th, 2006, 11:36am
 
hello!
Please don`t angry if my english is error becouse I am Japanese Students.
I want to make unusual typewiter.
For example ,

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /

I go to---shopping with my friends
............|
............|--school by bus , but it is ------cloud
...................................................|--snow .        
...................................................|--rain .

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /

like this.
But, i can`t express this text structure .
Use String Arry ? or use some text that specification coordinate?
Please take me some advise or hint.



Re: text tree
Reply #1 - Oct 5th, 2006, 2:26pm
 
Depending on what you want to do, you don't necessarily need a data structure that expresses the entire block of text.  For instance, you could do something like this:

Code:

void setup() {
noLoop();
}

void draw() {
write("/",45);
write("\n");
write("I go to");
write("-",3);
write("shopping with my friends");
write("\n");
write(".",15);
write("|");
write("\n");
write(".",15);
write("|");
write("-",2);
write("school by bus , but it is ");
write("-",6);
write("cloud");
write("\n");
write("etc");
write(".",44);
write("\n");
write("/",45);
}

void write(String s) {
print(s);
}

void write(String s, int n) {
for (int i=0; i<n; i++) write(s);
}


Are you writing a program that people will literally use like a typewriter, typing input as the program runs?
Re: text tree
Reply #2 - Oct 5th, 2006, 2:55pm
 
thank you jkriss!
apology for you my inexperience explanation.
I don't want to display that text.
for example ,

Frst, I type "I go to shopping with my freind",
Seccond, back to "I go to",
Third, I type "school by bus , but it is"

display --I go to shopping with my freind
-------------- "school by bus , but it is"
like this, two object is coexistence.Of couse not two sentence .
I want to show ramification sentens.


Re: text tree
Reply #3 - Oct 6th, 2006, 1:05am
 
Sorry, I'm still not quite getting it...

A couple of questions:

1. Do you want to display the words as graphics, or text output?

2. When you say "back to 'I go to'," what do you mean, exactly?  Are you hitting backspace until "shopping" is deleted, clicking on the spot on the screen after "go to," or something else entirely?
Re: text tree
Reply #4 - Oct 6th, 2006, 4:17am
 
Than you jkriss.
1 I want to display the words graphics.
2 I said "back to 'I go to'," means not BACKSPACE but LEFT .
  Move the cursor. "I go to (moved cursor position) shopping with my freind"
   
if type "school by bus , but it is" , slide up slantingly "shopping with my freind".
"school by bus , but it is" and "shopping with my freind" like a ramification.
Re: text tree
Reply #5 - Oct 6th, 2006, 2:27pm
 
In that case, I'd suggest that you take a look at the "Typing" example to see one way of handling typewriter-style graphics.

As for starting a new text strand/ramification, you can listen for mouse events, and base the new starting point on the click location.

In order to find the pixel location of particular letters, you can use the textWidth() method.

Hope this helps -- it sounds like an interesting sketch.
Re: text tree
Reply #6 - Oct 12th, 2006, 1:31pm
 
Hi Zarigani,
Lets see if I understand you correctly.
You want to create something like a menu. If you place the cursor over a word, it causes a sub-menu to come up.
And you want to place all the words in a character array, but don't know how to program it to display in the correct sub-menus right?

Well, if that is your problem, then what I humbly suggest is this......
Place a small number code in the string. Like "1school by bus".
For the sub menu, use another code, like "2rain".
The program should analyse the number and hence recognize which menu to place the word in.
OR
make separate arrays for each menu
OR
make a string array and then specify in your program, which array position starts with the first menu and where it ends. Which array position starts with the second menu and where it ends.

Hope I answered your question Smiley
Re: text tree
Reply #7 - Oct 12th, 2006, 4:47pm
 
Sorry I didn't reply for you jkriss.
I am not enough to say to thank for you becouse you associate with my raw English.Thank jkriss!!!!!
and thanks sd!
I think your advice is very near my program.
I anyhow make prototype text tree.
Please wacth my applet and code!
If you have a time , plese advice for me.

http://www.geocities.jp/jwtdd426/index.html

My questions-----------------------------------

If maked new sentences object inculed other sentences object(have maked sentences object before now maked),how to treatment of inculeded obect?


Page Index Toggle Pages: 1