Archive: SendMessage and SetCtlColors... text overlaying


SendMessage and SetCtlColors... text overlaying
  I don't understand this one.
On a custom page, I have a field (Field 8) that is there for me to throw warning messages. A number of radio buttons are on the page as well, and when the user select an option, sometimes he needs to be given a warning. If he then changes the selection for a safe option, the warning disappears
To make it visible, I set that field to a red color.


    !macro WarnExists _WILLERASE

!insertmacro MUI_INSTALLOPTIONS_READ $1 "ComposerDatabase.ini" "Field 8" "HWND"
SetCtlColors $1 /BRANDING "FF0000"
${If} $dbExists = 1
${AndIf} ${_WILLERASE} = 1
SendMessage$1 ${WM_SETTEXT} 0 "STR:A database file already exists. Selecting this option will overwrite it completely."
${Else}
;
SetCtlColors $1 000000 transparent
SendMessage$1 ${WM_SETTEXT} 0 "STR:Safe option"
${EndIf}
!macroend

>Function CustomPageLeave

!insertmacro MUI_INSTALLOPTIONS_READ $0 "ComposerDatabase.ini" "Settings" "State"

StrCmp $0 0 end

; $dbExists (global variable) contains 1 or 0
!insertmacro WarnExists $dbExists
Abort

end:

>FunctionEnd
>
However, what happens is that if the user selects an unsafe option, the correct message appears, but if he then selects another one (safe), the message does not disappear, and the "Safe option" message is showing *above* the other one...

Funnily enough, if I decide to have the messages in black (by not using the SetCtlColors", then everything is as it should be...

I've tried all sorts of things, like resetting the color to black first, send an empty message, send blank spaces... nothing works.

Any idea?

Try refreshing the label by hiding it and showing it again with ShowWindow (SW_HIDE, SW_SHOW).

-Stu