NSIS 对话中的两个无线电组
Two Radio Groups in NSIS dialogue
我在 NSIS 安装程序中有一个对话页面,我希望在该页面上有 2 个单选按钮组,每组有 3 个单选按钮。
每个组都是独立的,两个组都需要 selection。
我有以下代码,它显示创建了 2 个组,每个组有 3 个按钮,但是当安装程序运行时,所有 6 个按钮被分组为 1 个组,这意味着我只能 select 6 个中的 1 个,而不是每组 3 个按钮中的 1 个以上。
Function settingsTypePageCreate
nsDialogs::Create 1018
pop [=10=]
; Radio Group 1
${NSD_CreateGroupBox} 0 0 100% 40u "Select Method for specifying file locations"
Pop
${NSD_CreateRadioButton} 0 10% 100% 15u "Use Environment Variable."
pop
${NSD_CreateRadioButton} 0 25% 100% 15u "Use central config file."
pop
${NSD_CreateRadioButton} 0 40% 100% 15u "Use default %USERPROFILE%."
pop
; Radio Group 2
${NSD_CreateGroupBox} 0 60% 100% 40u "Select location folder"
Pop
${NSD_CreateRadioButton} 0 70% 100% 15u "%APPDATA%"
pop
${NSD_CreateRadioButton} 0 80% 100% 15u "%USERPROFILE%"
pop
${NSD_CreateRadioButton} 0 90% 100% 15u "PROGRAMDATA"
pop
nsDialogs::Show
FunctionEnd
此外,我在任何地方都找不到有关 NSD_Create 的位置和大小参数的描述。我不得不通过反复试验来做到这一点。
WS_GROUP
样式用于创建分组控件:
WS_GROUP
Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP
style FALSE after the first control belong to the same group. The next control with the WS_GROUP
style starts the next group (that is, one group ends where the next begins).
!include nsDialogs.nsh
Function settingsTypePageCreate
nsDialogs::Create 1018
pop [=10=]
; Radio Group 1
${NSD_CreateGroupBox} 0 0 100% 50u "Select Method for specifying file locations"
Pop [=10=]
${NSD_CreateRadioButton} 5u 12u 70% 12u "Use Environment Variable."
pop
${NSD_AddStyle} ${WS_GROUP}
${NSD_CreateRadioButton} 5u 24u 70% 12u "Use central config file."
pop
${NSD_CreateRadioButton} 5u 36u 70% 12u "Use default %USERPROFILE%."
pop
; Radio Group 2
${NSD_CreateGroupBox} 0 60u 100% 50u "Select location folder"
Pop [=10=]
${NSD_CreateRadioButton} 5u 72u 70% 12u "%APPDATA%"
pop
${NSD_AddStyle} ${WS_GROUP}
${NSD_CreateRadioButton} 5u 84u 70% 12u "%USERPROFILE%"
pop
${NSD_CreateRadioButton} 5u 96u 70% 12u "PROGRAMDATA"
pop
nsDialogs::Show
FunctionEnd
Page Custom settingsTypePageCreate
Page InstFiles
nsDialogs documentation中描述了测量:
Each of the measurements that the macros take can use one of three unit types - pixels, dialog units or percentage of the dialog's size. It can also be negative to indicate it should be measured from the end. To use dialog units, the measurement must be suffixed with the letter u. To use percentage, the measurement must be suffixed with the percentage sign - %. Any other suffix, or no suffix, means pixels.
Dialog units allow creation of dialogs that scale well when different fonts or DPI is used. Its size in pixels is determined at runtime based on the font and the DPI.
我在 NSIS 安装程序中有一个对话页面,我希望在该页面上有 2 个单选按钮组,每组有 3 个单选按钮。
每个组都是独立的,两个组都需要 selection。
我有以下代码,它显示创建了 2 个组,每个组有 3 个按钮,但是当安装程序运行时,所有 6 个按钮被分组为 1 个组,这意味着我只能 select 6 个中的 1 个,而不是每组 3 个按钮中的 1 个以上。
Function settingsTypePageCreate
nsDialogs::Create 1018
pop [=10=]
; Radio Group 1
${NSD_CreateGroupBox} 0 0 100% 40u "Select Method for specifying file locations"
Pop
${NSD_CreateRadioButton} 0 10% 100% 15u "Use Environment Variable."
pop
${NSD_CreateRadioButton} 0 25% 100% 15u "Use central config file."
pop
${NSD_CreateRadioButton} 0 40% 100% 15u "Use default %USERPROFILE%."
pop
; Radio Group 2
${NSD_CreateGroupBox} 0 60% 100% 40u "Select location folder"
Pop
${NSD_CreateRadioButton} 0 70% 100% 15u "%APPDATA%"
pop
${NSD_CreateRadioButton} 0 80% 100% 15u "%USERPROFILE%"
pop
${NSD_CreateRadioButton} 0 90% 100% 15u "PROGRAMDATA"
pop
nsDialogs::Show
FunctionEnd
此外,我在任何地方都找不到有关 NSD_Create 的位置和大小参数的描述。我不得不通过反复试验来做到这一点。
WS_GROUP
样式用于创建分组控件:
WS_GROUP
Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with theWS_GROUP
style FALSE after the first control belong to the same group. The next control with theWS_GROUP
style starts the next group (that is, one group ends where the next begins).
!include nsDialogs.nsh
Function settingsTypePageCreate
nsDialogs::Create 1018
pop [=10=]
; Radio Group 1
${NSD_CreateGroupBox} 0 0 100% 50u "Select Method for specifying file locations"
Pop [=10=]
${NSD_CreateRadioButton} 5u 12u 70% 12u "Use Environment Variable."
pop
${NSD_AddStyle} ${WS_GROUP}
${NSD_CreateRadioButton} 5u 24u 70% 12u "Use central config file."
pop
${NSD_CreateRadioButton} 5u 36u 70% 12u "Use default %USERPROFILE%."
pop
; Radio Group 2
${NSD_CreateGroupBox} 0 60u 100% 50u "Select location folder"
Pop [=10=]
${NSD_CreateRadioButton} 5u 72u 70% 12u "%APPDATA%"
pop
${NSD_AddStyle} ${WS_GROUP}
${NSD_CreateRadioButton} 5u 84u 70% 12u "%USERPROFILE%"
pop
${NSD_CreateRadioButton} 5u 96u 70% 12u "PROGRAMDATA"
pop
nsDialogs::Show
FunctionEnd
Page Custom settingsTypePageCreate
Page InstFiles
nsDialogs documentation中描述了测量:
Each of the measurements that the macros take can use one of three unit types - pixels, dialog units or percentage of the dialog's size. It can also be negative to indicate it should be measured from the end. To use dialog units, the measurement must be suffixed with the letter u. To use percentage, the measurement must be suffixed with the percentage sign - %. Any other suffix, or no suffix, means pixels.
Dialog units allow creation of dialogs that scale well when different fonts or DPI is used. Its size in pixels is determined at runtime based on the font and the DPI.