Advertisement

Text Menu Function problem

Started by August 15, 2002 04:09 PM
0 comments, last by Jackysan 22 years, 2 months ago
I've created a flexible text menu function. It takes the following format: IN SIMPLE FORM: draw_menu_text(page size, color, x1, y1, x2, y2, text, header) IN DATATYPE FORM: draw_menu_text(real, rgb, adv, adv, adv, adv, string, string) page size is a variable used to cut up the text string, I'll explain it later. color is the background color of the window. the x and y coordinates position and size the window. text is the text the window will show and header is text it will show in smaller font at the top of the message (for example, if you're talking to someone and you want their name to come up like "Bob says:"). The problem really lies in displaying the text string. That page size variable is used in conjunction with the width of the window to let the program know how many characters can string it can string across each line. It then loops through an array and cut's up the text string, placing each peice in each index of the array (the array is called "Lines[]"). Then it loops again, displaying the lines stored in the Lines[] array. This works just fine. HERE'S THE PROBLEM WITH THAT. The string is cut up by character which leads to words being split between lines! Does anyone have any idea on how I could get the program to reiderate through the Lines[] array and shift the words back together? I really don't want to have to scrap the whole thing, the Lines[] array and all, so while suggestions for redoing the script are still welcome, I'd prefer an idea on how to work with what I have so far. Here's an example of what gets stored in the Lines[] array: Lines[0] = "This is a String. Wh" Lines[1] = "atever happened to t" Lines[2] = "hat substitute teach" Lines[3] = "er from last weak?" [edited by - Jackysan on August 15, 2002 5:19:46 PM] [edited by - Jackysan on August 15, 2002 9:34:20 PM]
If you find a space character, back up ''til you reach the previous non-alphanumeric character, then cut there.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

This topic is closed to new replies.

Advertisement