MaxGUI Text area
BlitzMax Forums/BlitzMax Programming/MaxGUI Text area
| ||
Is it poss to read data in from a text area and still use ~n to start a new line, i've tried doing this and so far all i can get is ~n actually included in the text... thanks |
| ||
You mean when calling TextAreaText using TEXTAREA_LINES? Unfortunately you will need to crop the result as a TEXTAREA_LINES selection should always include the end of line character. text$=TextAreaText(textarea,0,1,TEXTAREA_LINES) text=text[..text.length-1] |
| ||
Well i usually use SetTextAreaText (systemtext,"Welcome~n~n") but if i try : SetTextAreaText (systemtext,TextAreaText(systemtext)+"~n" + result.getval(0,1) + "~n"+result.getval(0,2)) getval(0,1) being = "Welcome" and getval(0,2) being = "Welcome~n~nand thankyou" the output i get is : Welcome Welcome Welcome~n~nand thankyou instead of Welcome Welcome Welcome and thankyou |
| ||
can you explain how your getval(0,2) command works? ~n is translated into chr(10) characters by the blitzmax compiler (not the textarea gadget) so ~n only works with string literals (characters between quotes in .bmx source files) |
| ||
getval(0,0) is reading a string from a mysql database. it returns a String when called |
| ||
so if you want your stored strings to also use the ~n convention you will need to do something like:a$=ReadStringFromDataBase() a=a.Replace("~~n","~n") |
| ||
Thankyou does the job nicely |
| ||
trying to set the color of specific text using this code Function drawMsg(_textarea:TGadget,txt:String,append:Int,subject:String="",r:Int = 0, g:Int = 0,b:Int = 0,bold:Int =0) Local bg:Int = TextAreaLen(_textarea) Local tmpstr:String ="" If append = 1 Then tmpstr = TextAreaText(_textarea) EndIf LockTextArea(_textarea) If subject <> "" Then tmpstr = tmpstr + "~n" + subject +"~n" FormatTextAreaText(_textarea,r,g,b,1,bg,bg+10) EndIf tmpstr = tmpstr + txt tmpstr=tmpstr.Replace("~~n","~n") UnlockTextArea(_textarea) SetTextAreaText (_textarea,tmpstr) End Function but doesnt seem to work..... what have i missing? |
| ||
Sorry, another question when i use FormatTextareatext do i have to do the whole document ment again or should it retian formatting if i add new text? |