PDA

View Full Version : Append text into paragraph


Fashion
05-23-2006, 12:27 AM
Does anybody know how to append variable string into paragraph object ?

Variable string as Line . . . one
Variable string as Line . . . two
Variable string as Line . . . three
etc . . .

How to put a kind of carriage return (enter) automaticaly
after each line ?

I must use paragraph for the transparent background.

Thanks

Intrigued
05-23-2006, 07:23 AM
strAVariableHere.."\r\n"

longedge
05-23-2006, 02:12 PM
Label objects have transparent backgrounds and using concatenation is the way to produce a multi line label e.g.

str_content="Label line 1";
for count = 2, 10 do
str_content=str_content.."\r\nLabel line "..count;
Label.SetText("Label1", str_content);
end

Fashion
05-24-2006, 12:35 AM
Intrigued, it really help me to get an exemple please. I'm not sure
what to do with your code.

Thanks

Fashion
05-24-2006, 12:53 AM
This is the code i use:

A button start this action:

result = Dialog.FolderBrowse("Select folder:", "C:/");
Paragraph.SetText("Paragraph", result);

I need to click the same button again and append the next
result to the paragraph object.

Any help please ?

longedge
05-24-2006, 01:18 AM
This is the code i use:

A button start this action:

result = Dialog.FolderBrowse("Select folder:", "C:/");
Paragraph.SetText("Paragraph", result);

I need to click the same button again and append the next
result to the paragraph object.

Any help please ?

The " .. " that Intrigued and I mentioned concatenate (tack on to the end of) a string or variable to another one so if you change your code something like -

result = Dialog.FolderBrowse("Select folder:", "C:/");
content = content.."\r\n"..result
Paragraph.SetText("Paragraph", content);

this will make the string " content " longer and longer and each \r\n adds a new line. N.B. you have to set the initial value of content somewhere so if for instance you put -

content = Dialog.FolderBrowse("Select folder:", "C:/");

in your preload then that would initialise the string.

Fashion
05-24-2006, 11:58 AM
Sorry Guys, i don't know why but it does'nt work . . .

However, i finaly found this:

result = Dialog.FolderBrowse("Select folder:", "C:\\");
TextFile.WriteFromString("AutoPlay\\Docs\\Temp.txt", result.."\r\n", true)
result = TextFile.ReadToString("AutoPlay\\Docs\\Temp.txt");
Paragraph.SetText("Paragraph", result);

and it works great. A kind of paragraph update each time i choose and write
a new folder to the list.

"\r\n" seems to work with text file and not
with paragraph !!

Thanks

longedge
05-24-2006, 12:24 PM
The method works with both label and paragraph objects. The attached file has a label and paragraph side by side both of which display the concatenated string.

Fashion
05-25-2006, 12:52 AM
Thank you guy, it works great !