|
Post by Janet on Oct 28, 2007 12:25:21 GMT -5
a$ = httpget$("http://runbasic.wikispaces.com/space/showimage/USFDAMedSafety.txt")
cssid #filler, "{width: 500px; height: 100px}" cssid #textContainer2, "{background-color: rgb(255 255 192); border-style: ridge; width: 500px; height: 400px; overflow: auto}"
cls: print: print print a$ print: print
div filler: end div
textarea #textContainer1, a$
div filler: end div
div textContainer2 print a$ end div
end
Inside the div, the line breaks aren't recognized. I assume this is because html requires </br> for a line break. Is there a way I can save and/or read a text file such that line breaks will be preserved inside the div?
I tried, unsuccessfully, to save the file to disk as a temp file (using Alyce's method with her httpget$ / loadimage building block demo), hoping to use line input. I'll go reread the threads and demos and see if that's possible.
|
|
|
Post by mikeukmid on Oct 28, 2007 12:55:25 GMT -5
Thank you Janet, you have solved my problem on how to resize a textarea and change its font. For some reason I could not get css styles to work earier. Sorry but I can't answer your problem for now! Mike ;D EDIT: No, I realise now you created a division which looked like a textarea. Sorry Janet!
|
|
|
Post by billw on Oct 28, 2007 12:56:16 GMT -5
First choice would be to open the file, input each line, and then output it (appending a <br />). If you want to use a string in memory, use a find/replace function (there's one on the LB Wiki) to replace each CRLF with a CRLF and then a <br /> tag.
|
|
|
Post by Janet on Oct 28, 2007 14:30:36 GMT -5
First choice would be to open the file, input each line, and then output it (appending a <br />). If you want to use a string in memory, use a find/replace function (there's one on the LB Wiki) to replace each CRLF with a CRLF and then a <br /> tag. Can you give the code to open the file and then input each line? I couldn't do it. The only way I can read an online file is to put all contents into one string with the httpget$ command. Hmmm... let me work on parsing that string....
|
|
|
Post by Janet on Oct 28, 2007 14:32:03 GMT -5
Thank you Janet, you have solved my problem on how to resize a textarea and change its font. For some reason I could not get css styles to work earier. Sorry but I can't answer your problem for now! Mike ;D EDIT: No, I realise now you created a division which looked like a textarea. Sorry Janet! Sorry I couldn't be more helpful myself.
|
|
|
Post by billw on Oct 28, 2007 15:04:22 GMT -5
Janet, for working with files fetched via HTTP, you'll need to save the results of an httpget$() call to a temporay file. I was going to share a function that does part of this for you, but it doesn't seem to work in beta 4. Perhaps I should look into writing an HTTP utility module.
Of course, you could always use the in-memory method...
|
|
|
Post by Janet on Oct 28, 2007 15:19:46 GMT -5
Janet, for working with files fetched via HTTP, you'll need to save the results of an httpget$() call to a temporay file. I was going to share a function that does part of this for you, but it doesn't seem to work in beta 4. Perhaps I should look into writing an HTTP utility module. Of course, you could always use the in-memory method... I wonder why you can write an image file (jpg for example) to file on disk, but not a text file? Thanks for trying, Bill. At least I know I should put together a quick workaround and then get on with the rest of the program.
|
|
|
Post by Janet on Oct 28, 2007 22:53:32 GMT -5
My quick workaround
a$ = httpget$("http://runbasic.wikispaces.com/space/showimage/USFDAMedSafety.txt")
nLines = 0
For i = 1 to Len(a$) If Asc(Mid$(a$, i, 1)) = 13 Then nLines = nLines + 1 End If Next i
Dim a$(nLines) ct = 1 pos = 0 For i = 1 to Len(a$) If Asc(Mid$(a$, i, 1)) = 13 Then a$(ct) = Mid$(a$, pos + 1, i - pos) pos = i ct = ct + 1 End If Next i
cssid #textContainer2, "{background-color: rgb(255 255 192); border-style: ridge; width: 500px; height: 400px; padding: 20px 20px 20px 20px; overflow: auto}"
cls
div textContainer2 For i = 1 to nLines Print a$(i) Next i end div
end
|
|
|
Post by Jerry Muelver on Oct 29, 2007 7:00:19 GMT -5
In MSIE, things look okay. In FireFox, things look.... different. The DIV background is not colored, and the text paragraphs do not wrap to fit the DIV -- the horizontal scrollbar kicks in, and each paragraph is a single line running off invisibly past the DIV frame edge. I can't figure out why FireFox's line-wrap doesn't work.
|
|