Skip to content
⌘ NSIS Forum Archive

Highlight label's description text

4 posts

jdt2oo7#

Highlight label's description text

Hi all,

I created a custom component page, and some labels on that page also. I am wondering if it's a way to highlight label's description text when user click on the label? Like change to text Bold.

Thanks!
jpderuiter#
You can change the label to bold:
Var LABEL

Function nsDialogsPage

nsDialogs::Create 1018
Pop $0

${NSD_CreateLabel} 0 35 100% 12u "Test label"
Pop $LABEL
GetFunctionAddress $0 OnLabelClick
nsDialogs::OnClick $LABEL $0

nsDialogs::Show

FunctionEnd

Function OnLabelClick
; Set label to bold
CreateFont $R2 "MS Shell Dlg" 10 700
SendMessage $LABEL ${WM_SETFONT} $R2 0
; Force label redraw
ShowWindow $LABEL ${SW_HIDE}
ShowWindow $LABEL ${SW_SHOW}
FunctionEnd
Please note that you might experience some flikkering.
And the label gets obviously bigger when it's bold, so keep that in mind when positioning the other controls.
jdt2oo7#
Thanks jpderuiter! Label's text is bold when I click on it.

How would I un-bold previously selected label when I click on another one? I tried to redraw it but it remains bold.
jpderuiter#
Do the same, but then create a font with a weight of 400
(See CreateFont in the NSIS manual)