Skip to content
⌘ NSIS Forum Archive

nsis RadioButton

1 posts

ralfmeyer#

nsis RadioButton

hello

i try to build a user page with three radiobuttons. At start the first button should be active.

How can i do this?

Here my Dialog-Code:
Function usrDialogSetupTyp
    nsDialogs::Create 1018
    Pop $Dialog
    !insertmacro MUI_HEADER_TEXT "SetupTyp" "Wählen..."
    ${If} $Dialog == error
        Abort
    ${EndIf}
    
    ${NSD_CreateLabel} 0      0 125u 9u "Please ..."
    
    ${NSD_CreateLabel} 20u 27u 100% 9u "Alle für ..."
    ${NSD_CreateLabel} 20u 36u 100% 9u "notwendinen...."
    ${NSD_CreateLabel} 20u 49u 100% 9u "Dieser Insta..."
    ${NSD_CreateLabel} 20u 58u 100% 9u "verwendet we..."
    ${NSD_CreateLabel} 0 72u 100% 9u "Installationst..."
    
    ${NSD_CreateLabel} 20u   97u 100% 9u "Es wird  ..."
    
    ${NSD_CreateLabel} 20u 122u 100% 9u "Es wird ..."
    ${NSD_CreateLabel} 20u 131u 100% 9u "gespeich..."
    ${NSD_Check} $checkbox1
    ${NSD_CreateRadioButton}  0  15u 100% 12u "&Ein..."
    Pop $checkbox1
    ${NSD_OnChange} $checkbox1 usrDialogSetupTyp_Exit
    
    ${If} $checkbox1_State == ${BST_CHECKED}
        ${NSD_Check} $checkbox1
    ${EndIf}    
    ${NSD_CreateRadioButton}  0  85u 100% 12u "&Anw..."
    Pop $checkbox2
    ${NSD_OnChange} $checkbox2 usrDialogSetupTyp_Exit
    ${If} $checkbox2_State == ${BST_CHECKED}
        ${NSD_Check} $checkbox2
    ${EndIf}
    ${NSD_CreateRadioButton}  0 110u 100% 12u "&Dat..."
    Pop $checkbox3
    ${NSD_OnChange} $checkbox3 usrDialogSetupTyp_Exit
    ${If} $checkbox3_State == ${BST_CHECKED}
        ${NSD_Check} $checkbox3
    ${EndIf}
    Call usrDialogSetupTyp_Exit
    nsDialogs::Show
FunctionEnd
Var checkbox1_state
Var checkbox2_state
Var checkbox3_state
Function usrDialogSetupTyp_Exit
    StrCpy  $setuptyp "FEHLER"
    ${NSD_GetState} $checkbox1 $checkbox1_state
    ${If} $checkbox1_state == ${BST_CHECKED}
      StrCpy $setuptyp "alles"
         goto enable
    ${EndIf}
    ${NSD_GetState} $checkbox2 $checkbox2_state
    ${If} $checkbox2_state == ${BST_CHECKED}
      StrCpy $setuptyp "anwendung"
      goto enable
    ${EndIf}
    ${NSD_GetState} $checkbox3 $checkbox3_state
    ${If} $checkbox3_state == ${BST_CHECKED}
      StrCpy $setuptyp "datenbank"
      goto enable
    ${EndIf}
    GetDlgItem $1 $HWNDPARENT 1
    EnableWindow $1 0 
    goto raus
    enable:
      GetDlgItem $1 $HWNDPARENT 1
      EnableWindow $1 1
raus:  
FunctionEnd 
Can anybody help?

Best regards
Ralf