Old 26th July 2019, 10:16   #1
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
How to dynamically update a label text on the fly

Hi,

I have a label under which I am showing a progress bar. I need to display "Validation success " in the label after successful validation or else "Validation failed" .

Below is the code snippet

${NSD_CreateLabel} 0.09u 5.54u 102.03u 14.5u "Validating process"
$myLabel

${NSD_CreateProgressBar} 0.09u 21.54u 100% 10% ""
Pop $hwnd
${NSD_AddStyle} $hwnd ${PBS_MARQUEE}

${NSD_CreateTimer} StartValidation 1000

Function StartValidation

${NSD_KillTimer} StartValidation
Call Validate
${If} ${Errors}
SendMessage $myLabel ${WM_SETTEXT} 0 "Failed"
${Else}
SendMessage $myLabel ${WM_SETTEXT} 0 "Success"
${EndIf}
SendMessage $hwnd ${PBM_SETMARQUEE} 0 0
FunctionEnd
DivyaArun is offline   Reply With Quote
Old 26th July 2019, 10:19   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
Sending a string in a message requires the STR: prefix

Quote:
SendMessage $whatever ${WM_SETTEXT} 0 "STR:Hello"
You can also use the NSD_SetText macro.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump