Archive: SetCtlColors ${NSD_OnChange} Bug?


SetCtlColors ${NSD_OnChange} Bug?
In my Installer I use my own validation.
For the validation of Textfields I use the ${NSD_OnChange} to link to the validation function.
The validation-function then uses SetCtlColors to set the background of the textfield red.

The validation itself works fine(it also disables the Next button, which works perfect and without delay), unfortunately the Backgroundcolor change doesn't.
When I input a "wrong" value the Background first doesn't change at all and then(when i move the cursor or type in another character) changes weirdly like so: http://imageshack.us/photo/my-images/707/bughfd.png/ (http://imageshack.us/photo/my-images/707/bughfd.png/)
only when i move the cursor the background changes properly to red.

How do I fix this Problem? Is it a bug?


Try forcing a redraw of the control. You can do this by calling InvalidateRect with the System plug-in or simply hide and show the control using ShowWindow.

Stu


You need to call InvalidateRect or hide+show the window... (I'm pretty sure there is already a thread about this)


Thanks for you reply,
I tried the ShowWindow method but I get the same result,
this is the code I used:
SetCtlColors $hwndIP1 "" FF3333
ShowWindow $hwndIP1 ${SW_HIDE}
ShowWindow $hwndIP1 ${SW_SHOW}
and also tried to hide the control before I change the colour.

Edit: I didnt find a thread about the problem I have, I was looking for quite a while.
Ill try the invalidateRect method and report back


Originally posted by crisader
only when i move the cursor the background changes properly to red.

How do I fix this Problem? Is it a bug?
have you tried using LockWindow?

Thanks a lot, LockWindow in combination with ShowWindow works, although it flicker when i validate.
Edit: Sorry, it does work better but I sometimes still have the same Problem
(I used LockWindow off above the SetClColors)


Sorry for the doublepost;
After trying out pretty much everything i found on the forums, i found out that the least amout of code that does the trick(without flickering) is:
SetCtlColors $hwndTextfield "" FF3333
System::Call "user32::InvalidateRect(i,i,i)i ($hwndTextfield, 0, 1)"


I'm not really sure why SetCtlColors does not call InvalidateRect, you could add a feature request (or bug report?) for it if you want...