NSIS RadioButton如何分组

时间:2017-07-26 08:52:14

标签: nsis

NSIS接口配置文件ini中有多个RadioButton控件,如何使用group属性对它们进行分组?该属性如何设置该值?如何写?帮助我!

1 个答案:

答案 0 :(得分:0)

它在Install Options documentation

中说得很对

GROUP:

  

将此标志添加到一组控件的第一个控件中以对其进行分组。分组控件允许您创建多组单选按钮,并使用箭头键更轻松地进行键盘导航。

NOTABSTOP:

  

当用户按Tab键时,不要停在控件上。将NOTABSTOP添加到除第一个组之外的组的所有控件,以允许使用Tab键在组之间导航。

RequestExecutionLevel User
OutFile "test.exe"

Function .onInit
; Writing out the .ini manually here to keep the example in one source file
InitPluginsDir
WriteIniStr "$PluginsDir\MyPage.ini" Settings NumFields 4
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Type RadioButton
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Text G1:Radio1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Flags GROUP
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" State 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Left 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Right -1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Top 0
WriteIniStr "$PluginsDir\MyPage.ini" "Field 1" Bottom 10
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Type RadioButton
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Text G1:Radio2
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Flags NOTABSTOP
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Left 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Right -1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Top 10
WriteIniStr "$PluginsDir\MyPage.ini" "Field 2" Bottom 20
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Type RadioButton
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Text G2:Radio1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Flags GROUP
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Left 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Right -1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Top 50
WriteIniStr "$PluginsDir\MyPage.ini" "Field 3" Bottom 60
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Type RadioButton
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Text G2:Radio2
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Flags NOTABSTOP
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" State 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Left 1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Right -1
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Top 60
WriteIniStr "$PluginsDir\MyPage.ini" "Field 4" Bottom 70
FunctionEnd

Section
SectionEnd

Page Custom MyPage
Page InstFiles

Function MyPage
InstallOptions::dialog "$PluginsDir\MyPage.ini"
Pop $0
FunctionEnd