New line with Area Text Object

BlitzPlus Forums/BlitzPlus Programming/New line with Area Text Object

Walter(Posted 2004) [#1]
I did a loop to fill an area text by a list of several names:

SetGadgetText(area,TextAreaText(area)+Name$(i))

Problem is that all the names are "attached", I'd like one name by line, so I added:

SetGadgetText(area,TextAreaText(area)+$0D+$0A)

It doesn't work because $0D and $0A are considered like characters... Without using a List Object what's the solution?


skidracer(Posted 2004) [#2]
use Chr(10)


Walter(Posted 2004) [#3]
I'm going to try! Thanks ;)


Walter(Posted 2004) [#4]
yep, Chr(10) works!
An now, how to make the area field not editable ? Disable the gadget disables the scrollbar bars too, so that's not right.


WolRon(Posted 2004) [#5]
;.lib "user32.dll"
;SendMessage%(hWnd%,Msg%,wParam%,lParam%):"SendMessageA"

;Constant related to text area functionality
Const EM_SETREADONLY = $CF

SendMessage QueryObject(YourTextArea, 1), EM_SETREADONLY, True, 0


aab(Posted 2004) [#6]
depending apon how large it is u can reapply the textarea text every loop. the lib'll be less consuming though..


Walter(Posted 2004) [#7]
It works, thanks! Except for Const EM_SETREADONLY = $CF, it generates an error, so I directly use $CF when I call the function.
I'm quite desappointed that Blitz doesn't include a such important function!
I guess there's also a specific function to limit the number of characters in a field?? As I don't know I do like that:

field$=TextFieldText(hdl_field)
If Len(field$)>SIZE_FIELD
SetGadgetText(hdl_field,Left(field$,SIZE_FIELD))
EndIf


rdodson41(Posted 2004) [#8]
I don't think there is a specific function built in, but that will do it for you.


WolRon(Posted 2004) [#9]
Except for Const EM_SETREADONLY = $CF, it generates an error
It shouldn't. Are you sure you placed the constant declaration OUTSIDE of any functions?


Walter(Posted 2004) [#10]
Actually, I thought it was possible to declare a constant in the decls file and then use it in Blitz.