TextArea

BlitzPlus Forums/BlitzPlus Beginners Area/TextArea

plash(Posted 2006) [#1]
how can i save the text to a file from textarea with NO of those litte box thingys..

and is there a place where i can find an example that adds preset text to the cursors position?


WolRon(Posted 2006) [#2]
What the heck is a "little box thingy"?

I think I know what you mean. The "little box thingies" are placed there due to the limitations of the font that is representing the text because it doesn't include the special characters in the font (such as TAB characters). Using a different font often corrects the problem.

Or you can modify the text that includes the special characters by replacing the special characters with something else (or nothing at all).


plash(Posted 2006) [#3]
yea when u use "text"+chr$(13)+"text" etc etc..
it gives me them boxes, in some cases its a line.
ill try different fonts, thanks.


plash(Posted 2006) [#4]
also, like ctrl+v in the textarea thing it inputs the text from the clipboard. id like to know how to do such a thing, only with using some text thats set in the program.. like addgadgettextlinepos "txt"+chr$(13)+"txt"(etc.etc) ?
get my idea?


WolRon(Posted 2006) [#5]
It's all there for you. Just use the commands available to Text Areas and gadgets, such as:
TextAreaText
TextAreaCursor
TextAreaChar
TextAreaLen
SetTextAreaText
AddTextAreaText
SetGadgetText


plash(Posted 2006) [#6]
kinda sucks that i have to use my browser to find out what all those do.. sure wish they put the parameters/how to use with the proggy


plash(Posted 2006) [#7]
setting the text did dipsquat, and i have to beable to tell where my next lines are, this is gonna be a java/html txt based editor that supposibly is going to have preset text to make things for convenient.
example, htmltags/newhtml

<html>
<head>
<title>TITLE-NUM=Type.EXT.IMPXMJS</title>
</head>
<body>
</body>
</html>

code
SetGadgetText txtbox,"<html>"+Chr$(13)+"<head>"+Chr$(13)+"<title>TITLE-NUM=Type.EXT.IMPXMJS</title>"+Chr$(13)+"</head>"+Chr$(13)+"<body>"+Chr$(13)+"</body>"+Chr$(13)+"</html>"

if i were to delete the chr$(13) cmds in it id have a problem


WolRon(Posted 2006) [#8]
sure wish they put the parameters/how to use with the proggy
Say what? They are all in the help documentation!
Type any one of them into the editor and press F1.

if i were to delete the chr$(13) cmds in it id have a problem
Then don't delete them. What's the problem?

i have to beable to tell where my next lines are
Then parse through the text looking for the Chr$(13)'s


plash(Posted 2006) [#9]
well, heres what it saves to
<html>

;(must be this text, but from here on every line has those boxes before it)
<head>

<title>TITLE-NUM=Type.EXT.IMPXMJS</title>

</head>

<body>

</body>

</html





WolRon(Posted 2006) [#10]
WriteLine automatically terminates whatever string you write with $0D$0A [Chr$(13)+Chr$(10)], so your text files had multiple $0D$0A$0D$0A at the end of every line. Just adding the Trim command to your WriteLine function seems to do the trick...

win = CreateWindow("Text Window",0,0,400,300)
Global txtbox = CreateTextArea(0, 0, 200, 100, win)
button = CreateButton("Save", 50, 150, 100, 30, win)

Global filename$ = "textfile.txt"

Repeat
	ID = WaitEvent()
	If ID=$803 Then Exit
	If ID=$401
		If EventSource() = button Then savetext()
	EndIf
Forever 

Function savetext()
	f=WriteFile(filename$)
	temp_len=1
	For i=0 To TextAreaLen(txtbox, 2) ;count lines 
		WriteLine(f, Trim(Mid$(TextAreaText(txtbox), temp_len, TextAreaLineLen(txtbox, i))))
		temp_len=TextAreaChar(txtbox, i+1)
	Next
	CloseFile(f) 
End Function


By the way, when posting code, use the forum codes:
What are the forum codes?


plash(Posted 2006) [#11]
yea i knew the codebox thing i just forgot to use it, and thanks alot.


WolRon(Posted 2006) [#12]
There is an Edit link you know...


plash(Posted 2006) [#13]
true