Old 12th April 2012, 10:38   #1
crisader
Junior Member
 
Join Date: Apr 2012
Posts: 10
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/)
only when i move the cursor the background changes properly to red.

How do I fix this Problem? Is it a bug?
crisader is offline   Reply With Quote
Old 12th April 2012, 11:48   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,377
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
Afrow UK is offline   Reply With Quote
Old 12th April 2012, 11:49   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 3,416
You need to call InvalidateRect or hide+show the window... (I'm pretty sure there is already a thread about this)

IntOp $PostCount $PostCount + 1
Anders is online now   Reply With Quote
Old 12th April 2012, 11:57   #4
crisader
Junior Member
 
Join Date: Apr 2012
Posts: 10
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
crisader is offline   Reply With Quote
Old 12th April 2012, 17:16   #5
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,278
Send a message via ICQ to Yathosho
Quote:
Originally Posted by crisader View Post
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?
Yathosho is offline   Reply With Quote
Old 13th April 2012, 08:49   #6
crisader
Junior Member
 
Join Date: Apr 2012
Posts: 10
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 is offline   Reply With Quote
Old 13th April 2012, 14:07   #7
crisader
Junior Member
 
Join Date: Apr 2012
Posts: 10
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)"
crisader is offline   Reply With Quote
Old 13th April 2012, 21:07   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 3,416
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...

IntOp $PostCount $PostCount + 1
Anders is online now   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