Refresh Layer
Hello,
I am trying to display a message on a nsis 2.46.5-Unicode MUI2 page while calling a function.
Thing is, the text will only be displayed after the function closes.
The only way I found to avoid this was to include a MessageBox.
Is there a way to 'refresh' the page/layer without using a MultiProcess plugin or a MessageBox?
Example:
"MUI2.nsh"
NSD_CreateLabel} 0 90% 100% 10u ""
>!include "nsDialogs.nsh"
>!define PRODUCTNAME "RefreshLayer"
>Name "${PRODUCTNAME}"
>OutFile "${PRODUCTNAME}.exe"
>RequestExecutionLevel user
>!define BLACK "0x000000"
>!define RED "0xFF0000"
>!define GREEN "0x009900"
>!insertmacro MUI_LANGUAGE "English"
>;------------------------
!macro _ConsoleWindowRefresh CONTROL STRING COLOR COLORBACK
ShowWindow${CONTROL} ${SW_HIDE}
SetCtlColors ${CONTROL} "${COLOR}" "${COLORBACK}"
${NSD_SetText} ${CONTROL} "${STRING}"
ShowWindow ${CONTROL} ${SW_SHOW}
!macroend
>!define ConsoleWindowRefresh "!insertmacro _ConsoleWindowRefresh"
>;------------------------
>Page custom nsDialogsMainPage
Section ""
>SectionEnd
>Function nsDialogsMainPage
!insertmacro MUI_HEADER_TEXT $(PAGEMAIN_TITLE) $(PAGEMAIN_SUBTITLE)
nsDialogs::Create 1018
Pop$0
${If} $0 == error
Abort
${EndIf}
${
Pop $R0
${NSD_CreateButton} 20% 30% 20% 40u "TestWithoutMSGB"
Pop $R1
${NSD_OnClick} $R1 TestWithoutMSGB
${NSD_CreateButton} 60% 30% 20% 40u "TestWithMSGB"
Pop $R2
${NSD_OnClick} $R2 TestWithMSGB
nsDialogs::Show
FunctionEnd
>Function TestWithoutMSGB
${ConsoleWindowRefresh} $R0 " never to be seen... " "${RED}" "${BLACK}"
Sleep 1000
${ConsoleWindowRefresh} $R0 " Ever to be seen... " "${GREEN}" "transparent"
>FunctionEnd
>Function TestWithMSGB
${ConsoleWindowRefresh} $R0 " never to be seen... " "${RED}" "${BLACK}"
MessageBox MB_OK " ... "
${ConsoleWindowRefresh} $R0 " Ever to be seen... " "${GREEN}" "transparent"
>FunctionEnd
>