Textarea

TEXTAREA
A Run BASIC **Textarea** is similar to Liberty BASIC's **Texteditor**. It is a multiline texteditor with a vertical scrollbar. It can be filled with text as it is created, or later by the programmer. The user can type text into it and the program can retrieve it.

The syntax is as follows:

TEXTAREA #handle, expr - Add a textarea to the web page with #handle and filled with the result of expr (string or numeric)


 * TEXTAREA methods**
 * 1) handle CONTENTS$ //- Return the contents of the textarea as a string//
 * 2) handle VALUE //- Return the contents of the textarea as a number//
 * 3) handle TEXT(expr$) //- Set the contents of the textarea//
 * 4) handle PRINT(expr$) //- Append expr$ to the contents of the textarea//
 * 5) handle PRINTLN(expr$) //- Append expr$ and and CR to the contents of the textarea//
 * 6) handle ISNULL //- Returns zero (or false)//
 * 7) handle DEBUG$ //- Returns the string "Textarea"//
 * 8) handle SETFOCUS //- Set the input focus to this control when the page is displayed//

This code demonstrates the **Setfocus$**,**Text** and **Contents$** methods. code textarea #t, "",10,10
 * 1) t text("Hello, World!")

print print "Contents of textarea: " print #t contents$ wait code
 * 1) t setfocus

This code demonstrates the **Debug$** and **IsNull** methods. code print "Before creation, IsNull returns:" print #t isnull textarea #t, "",10,10 print print "After creation, IsNull returns:" print #t isnull wait code
 * 1) t print("I'm a ";#t debug$)

Demonstration program showing the different print, text & println methods for a textarea, retrieving the contents and creating a textarea with predefined text.

code format="vbnet" [start] cls textarea #ta, "" 'two print statements but both print to same line 'force a new line on browser page for the link print "" link #cnt,"Continue",[cont] wait [cont] gosub [refresh] 'println method appends a CR/LF 'print blank line CR/LF only 'print method has no CR/LF 'force a new line on browser page for the link print " " link #nxt, "Next", [next] print " " wait
 * 1) ta print("Run";chr$(32))
 * 2) ta print("BASIC (two words on same line)")
 * 1) ta println("")
 * 2) ta println("CR/LF appended to this one")
 * 1) ta println("")
 * 2) ta println("New line")
 * 1) ta print("Another new line")

[next] gosub [refresh] print " " print "Contents of Textarea is: " print text$ print " " link #clr, "Clear textarea", [clearTa] wait

[clearTa] 'text method replaces all text with quoted string, in this case an empty string print " " link #res, "Restart", [start] wait
 * 1) ta text("")

[refresh] 'get the contents of textarea into a string text$ = #ta contents$ 'clear the page cls 'create the textarea and fill with text$ textarea #ta, text$ return code