Archive: Refresh a label on a custom window


Refresh a label on a custom window
Hello,
(I'm very very very bad in english)
I'm a newbie on NSIS, and I try to make an easy thing :

On a custom window,I have a label and a button

before MUI_INSTALLOPTIONS_SHOW, I verify something and I modify the color and the text of the label like that :

GetDlgItem $label $HWND 1204
SetCtlColors $label 0xFF0000 "transparent"
SendMessage $label ${WM_SETTEXT} 0 "STR:non installé"

and it works :D

if I click on the button, I want to change the color and the text of the label. I do that :
GetDlgItem $label $HWND 1204
SetCtlColors $label 0x00AA00 "transparent"
SendMessage $label ${WM_SETTEXT} 0 "STR:Installé"

The new text overwrites the older but the older is not erased ; it can be seen under ????!!!!!! :weird:
If I open a window on the custom window, the label is refreshed. How can I refresh the label ? :cry:


The best way to get around this would be not to use a transparent background. If you can't, try calling RedrawWindow or UpdateWindow using System.dll.


I must use transparent background because I don't know the background color of the window (it's a system color)...

But how can I use System.dll and RedrawWindow or UpdateWindow ? (sorry,I'm a really newbie !...)


If you want the system dialog background color you can simply not specify a background color:

SetCtlColors $label 0xFF0000

If I not specify a background color, the foreground color don't works : it stay black !


Hmm... Right, can't have text color without background, it will be ignored. You can hide and show the control using:

ShowWindow $0 ${SW_HIDE}
SendMessage $0 ${WM_SETTEXT} "" STR:$0
ShowWindow $0 ${SW_SHOW}
Make sure you include WinMessages.nsh before using that code:
!include WinMessages.nsh

It wooooooooooooorks !!!!!!!!!!!!!!!!!!!!

It's a work-around but It works ! Thx you !!

Thx thx !