Archive: change label text multiple times


change label text multiple times
Hello NSIS experts,

I'm a newbie to NSIS and have to enhance some existing installer code. There is a page which accepts certain parameters (input from text fields) and manipulates them (when Next is clicked). The error messages generated are shown above the input fields in a Label with red color.

The page uses MUI. Displaying a message in the red Label is not an issue. Code currently is using


GetDlgItem $1 $hwnd 1204 ; PathRequest control (1200 + field 5 - 1)
SendMessage $1 ${WM_SETTEXT} 0 'STR:$0' ;show the message generated by external param checker


The error message on the label will change based on several attempts by user and before displaying each message it would be needed to clear the label. I've tried inserting bunch of \r\n in the label and another attempt was with bunch of spaces. None seem to work. New error message gets overwritten on the previous one.

Please help me by pointing me in the right direction to some samples or at least helping me realize the capabilities of Label type fields.

Thanks and have a good day,
HB

I think this is a COM issue more than an NSIS issue, but I am guessing you need to send a message to the parent window so that it redraws the rest of the window, eliminating the leftover text from the previous error message.


Hi folks. I figured it out. In the existing code, I missed the part where the bg color was set to be transparent (with red text) and hence my attempt to put strings with spaces and \r\n were not erasing the previous messages.

This is how it got fixed:
Changed the bg color to be something non transparent and write a "STR:" to that Label. Then changed it back to the desired red text and transparent bg color and write the error message on it.