Skip to content
⌘ NSIS Forum Archive

Appending into a text box?

3 posts

dennisb555#

Appending into a text box?

I have a custom page with a large multiline text area.

I'd like to fill this text area in with the contents of a file (say 2-3k in size) if the file exists. The user can edit/hack this content to their desire.

If the file does not exist then I want the user to have the ability to cut-n-paste content into this text area (which will later be saved to a file).

My issue. How do I append into a text area from my NSIS script one line at a time (e.g. from the output of FileRead)?
Is it even possible?

I know I can append into a list box, but I can not use a list box in this case because the user needs to be able to edit and add content.

The FileRead function works on a line by line basis. Hence, I believe I need to append into the text area as soon as a line has been read. Note, I can not append up a big string with the file content and then do a single WM_SETTEXT due to 1024 string length issues (my content may be more than 1024 characters).

Is there some type of appending to text area 'SendMessage' I can use?

Multiple "SendMessage .. ${WM_SETTEXT} .." will not work since each SendMessage will overwrite rather than append to the text area.

Gee, I hope "Text" controls can do what I want to do.

Any assistence would be grateful.

Dennis.
dennisb555#
Re: Appending into a text box?

Oops, sorry for wasting anyone's time.

I think I figured it out.

FileRead $0 $1
SendMessage $R1 ${EM_REPLACESEL} 0 "STR:$1"

appears to work.

Sorry, I'm just coming up to speed with the loveliness that is Windows GUI programming.

Dennis.
Red Wine#
You'd need the special 8k nsis build.
Append each line of the text to a variable as described here,
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.

and finally add it to the text field.