Skip to content
⌘ NSIS Forum Archive

Read-only checkbox on custom page

5 posts

Seban#

Read-only checkbox on custom page

Hello,

I am trying to display the chosen components on a summary page. I use checkboxes to do this:
${NSD_CreateCheckBox} 0 44u 100% 12u "Component 1"
Pop $chkComp1
${If} ${SectionIsSelected} ${Section1}
${NSD_Check} $chkComp1
${EndIf}
Is it possible to set the checkbox read-only? I did this with a textbox:
${NSD_CreateText} 0 13u 100% 12u $(summary_text_path)
Pop $txtPath
SendMessage $txtPath ${EM_SETREADONLY} 1 0


Unfortunately it seems not to work with checkboxes.

Another idea I had was disabling the checkboxes (EnableWindow $chkComp1 0), but this grays out the boxes and the caption and I don't like the look of it.

My third idea would be using images of checkboxes and putting them next to labels, but I think there is a better way to do this.

Can someone help me out? Thanks in advance!
T.Slappy#
Quick idea: what about placing other control (which support transparency 0 label, image, ...) over your checkbox?
User will not be able to click the checkbox as control above it will catch the event.
Afrow UK#
Originally Posted by T.Slappy View Post
Quick idea: what about placing other control (which support transparency 0 label, image, ...) over your checkbox?
User will not be able to click the checkbox as control above it will catch the event.
That is not a good idea because the user can use Tab to access the control and then Space to change its state.

If you want a read-only check box then I would advise disabling it. This is what the user expects and not having it disabled will probably result in people thinking it's a bug.

Stu
Seban#
Originally Posted by Afrow UK View Post
If you want a read-only check box then I would advise disabling it. This is what the user expects and not having it disabled will probably result in people thinking it's a bug.
That's a very good point.

Now I'm going to create the checkboxes (disabled) with empty strings as caption and put labels next to them. Then the checkboxes are disabled, but the text remains black.

Thanks to both of you for your help.
Anders#
Originally Posted by Afrow UK View Post
That is not a good idea because the user can use Tab to access the control and then Space to change its state.

Stu
You could remove the WS_TABSTOP style from the checkbox