crisader
12th April 2012 10:38 UTC
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?
Afrow UK
12th April 2012 11:48 UTC
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
Anders
12th April 2012 11:49 UTC
You need to call InvalidateRect or hide+show the window... (I'm pretty sure there is already a thread about this)
crisader
12th April 2012 11:57 UTC
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
Yathosho
12th April 2012 17:16 UTC
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?
crisader
13th April 2012 08:49 UTC
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)
crisader
13th April 2012 14:07 UTC
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)"
Anders
13th April 2012 21:07 UTC
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...