No announcement yet.

To force the state of a chekbox or other buttons

  • Filter
  • Time
  • Show
Clear All
new posts

  • To force the state of a chekbox or other buttons


    I am looking to force the state of my buttons, in my .nsi file, on a custom page.

    First, I would like to force the checkbox on "check" and fix it on check. So the function Onclick is useless.

    Second, I have different radio buttons on my custom page, and I would like them all to be select at the loading of the page. Because, by default, the first on is select.

    Thank you by advance to your precious help.

    Have a good day.

    An exemple of my tests, maybe, I am on the write way ?! :

    ${NSD_CreateCheckBox} 15u 30u 56u 45u MyText
    Pop $R0
    StrCpy $R0 1
    SetCtlColors $R0 ${LabelTextColor} ${LabelBackgroundColor}
    ${NSD_GetState} $R0 $1
    StrCmp $R0 0 0 next
    StrCpy $R0 1
    next: ...

  • #2
    To check a checkbox use
    ${NSD_Check} $R0
    To disable a control use
    ${NSD_AddStyle} $R0 ${WS_DISABLED}
    To be able to enable the checkbox later, use a global variable instead of $R0, and then use
    EnableWindow $MyCheckBox 1 ; 0 = disabled, 1 = enabled
    to enable the checkbox.

    Do you mean to check all radiobuttons at the same time?
    That's against the nature of a radiobutton.
    You can use
    ${NSD_Check} $R1
    on all radiobuttons to have them all selected at the same time.
    But as soon as you select one of them, the rest will become unchecked.

    Please read the nsDialogs documentation, it's all there:



    • #3
      Oh sorry I made a mistake, I would like all my radio buttons be unselected at the loading of the page !!

      For the moment I managed to unselect them all, but now I can't select them anymore ! When I valid my selection, it consider that all the radio buttons are unselected !!


      • #4
        If you just create radiobuttons, without using ${NSD_Check} or anything, all radiobuttons will be unchecked.

        What do you mean you can't select them anymore?
        Can you give a small script which reproduce your problem?