Skip to content
⌘ NSIS Forum Archive

nsDialogs - GroupBox and RadioButtons problem

5 posts

Pawel#

nsDialogs - GroupBox and RadioButtons problem

Hello, I ma trying to write nsdialogs page, that uses 2 GroupBox components and a few RadioButtons components, for each of the GroupBox.
This is how I create the page:
Function CreateAutoRunPage
!insertmacro MUI_HEADER_TEXT "$(A_12)" "$(A_13)"
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
; GroupBox 1    
${NSD_CreateGroupBox} 0 40u 100% 40u "$(A_3)"    
Pop $GB_Ar1
    
; RadioButton 1    
${NSD_CreateRadioButton} 7% 59u 40% 10u "$(A_4)"
Pop $RB_Ar1
; RadioButton 2
${NSD_CreateRadioButton} 57% 59u 40% 10u "$(A_5)"
Pop $RB_Ar2    
    
; GroupBox 2    
${NSD_CreateGroupBox} 0 85u 49% 45u "$(A_6)"    
Pop $GB_Ar2    
    
; RadioButton 3    
${NSD_CreateRadioButton} 7% 98u 40% 10u "$(A_7)"
Pop $RB_Ar3
; RadioButton 4    
${NSD_CreateRadioButton} 7% 113u 40% 10u "$(A_8)"
Pop $RB_Ar4            
    
    nsDialogs::Show
        
FunctionEnd 
So, we created 2 GroupBox. Each of this GroupBox have two RadioButtons components. In each GroupBox ONLY 1 RadioButton can be selected. When I select 1 radiobutton of 1 Groupbox every radiobuttons are unselected. Please, tell me, how to do to select/unselect radiobuutons for each GroupBox only, not for all page...
I tried to use ${WS_GROUP} style, but it is not working...
Tried this:
SendMessage $GB_Ar1 ${WS_GROUP} 1 0
and this
${NSD_AddExStyle} $GB_Ar1 ${WS_GROUP}
and nothing, it is not working. GroupBox have to be separated.
Thanks for any help,
-Pawel

Attachments

Anders#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Pawel#
Thanks Anders,
It work!
Ps:
The solution was adding this code after creating each GroupBox and first of RadioButton of each group.
${NSD_AddStyle} HANDLE ${WS_GROUP}|${WS_TABSTOP}

Thanks again, regards
-Pawel
{_trueparuex^}#
WS_GROUP is not EX style so use ${NSD_AddStyle} instead of ${NSD_AddExStyle} and you should add the WS_GROUP style to the first RadioButton control of the group, not to the GroupBox control.

Function CreateAutoRunPage

!insertmacro MUI_HEADER_TEXT "$(A_12)" "$(A_13)"
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}

; GroupBox 1
${NSD_CreateGroupBox} 0 40u 100% 40u "$(A_3)"
Pop $GB_Ar1

; RadioButton 1
${NSD_CreateRadioButton} 7% 59u 40% 10u "$(A_4)"
Pop $RB_Ar1
${NSD_AddStyle} $RB_Ar1 ${WS_GROUP}

; RadioButton 2
${NSD_CreateRadioButton} 57% 59u 40% 10u "$(A_5)"
Pop $RB_Ar2


; GroupBox 2
${NSD_CreateGroupBox} 0 85u 49% 45u "$(A_6)"
Pop $GB_Ar2

; RadioButton 3
${NSD_CreateRadioButton} 7% 98u 40% 10u "$(A_7)"
Pop $RB_Ar3
${NSD_AddStyle} $RB_Ar3 ${WS_GROUP}

; RadioButton 4
${NSD_CreateRadioButton} 7% 113u 40% 10u "$(A_8)"
Pop $RB_Ar4

nsDialogs::Show

FunctionEnd
Edit: Too slow. 🙂

PaR