PDA

View Full Version : Text editing through paragraph


nirus
02-16-2005, 06:58 AM
While I love the paragraph object, I am unable to select its text and copy it to the clipboard.

I want to load a file to an object and be able to select its text. The only solution I have found to this is to dynamicly create a web page from the file Code looks like this:

<textarea style="width:100%; height:100%>"..MyFile.."</textarea>

Now this is ugly because it embeds an html doc with scroll bars(disabled) and then the texarea also gets scroll bars.
I messed around with the textbox object but I can not get it to write out the new lines with \r\n.
I would much rather use paragraph because it looks awesome!!
Any ideas or inputs for me?

-Nirus

Corey
02-16-2005, 07:09 AM
HI. Whenever I include "selectable" text in an application I tend to do so using an input object. Hope that helps... :)

nirus
02-16-2005, 02:39 PM
Only problem with the input box, I am having trouble readin and existing file to it. I am having problems parsing new lines to \r\n. Not only that but I would like to make a a syntaxt highlighter for files containing code. That kinda limits the input ox I think. I should have mentioned that

-Nirus

Leko
02-16-2005, 03:25 PM
Have you tried loading the text to a variable and then using the lable, or whatever other object your are using, with that variable?

nirus
02-16-2005, 04:01 PM
Here is my solution for now. But it looks bad with all the scrollbars. I only want 1. This also gives limitation because it is in a web object.
SelectedFile = ListBox.GetSelected("sourcebox");
if(SelectedFile)then
local strFolderName = "";
local strText = ListBox.GetItemText("sourcebox", SelectedFile[1]);
local strPath = ListBox.GetItemData("sourcebox", SelectedFile[1]);
strcode = TextFile.ReadToString(strPath);
strcode = "<html><head></head><body topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0><textarea style=\"width:100%; height:98%; background-color:#E3E3E3; color:#008000;\">"..strcode.."</textarea></body></html>";

TextFile.WriteFromString("AutoPlay\\Docs\\koad.html", strcode, false);
Web.LoadURL("filecode", "AutoPlay\\Docs\\koad.html");
end

Have you tried loading the text to a variable and then using the lable, or whatever other object your are using, with that variable?
I think what you mean here is just getting the text to display on the object. Yes I can get the text to go where I want but I can not select it unless it is in an inputbox. With input boxes, I can not seem to parse the string to make new lines into \r\n

-Brent

JimS
02-16-2005, 04:04 PM
If I understand your question correctly, then Brett has built a great example that shows you exactly how to do what you're after.

Check it out

http://www.indigorose.com/forums/showthread.php?t=7942&highlight=simple+text+editor