怎么在2个GUICtrlCreateGroup组中同时只能选在一个按钮选项呢(已解决)
本帖最后由 asura 于 2011-12-20 19:04 编辑#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Group1 = GUICtrlCreateGroup("总体", 72, 64, 505, 321)
$Group2 = GUICtrlCreateGroup("系统类", 120, 136, 201, 169)
$Radio1 = GUICtrlCreateRadio("IE修复", 144, 176, 65, 17)
$Radio2 = GUICtrlCreateRadio("系统补丁", 240, 177, 73, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("输入法", 328, 136, 209, 169)
$Radio3 = GUICtrlCreateRadio("搜狗输入法", 351, 172, 89, 17)
$Radio4 = GUICtrlCreateRadio("五笔输入法", 452, 175, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
我只想每次选择一个按钮 ,如果是一个Group组中 是没问题的,但是在2个group组中就不行 了, 可以2边同时选中,我只想让它选中一个此时此刻 而不是可以选择2个或者更多
图片如下: 分组本身作用就是这样,要么做成同一个组,要么动态分配另外那个组 回复 2# Qokelate
我想问下那怎么动态分组呢 选择一个Radio后,设置另一个组的Radio为未选中状态 回复 4# Qokelate
不知道大虾能不能给具体些代码,谢谢了 参考GUIStartGroup 学习学习,留个脚印 #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $RadioID = 0, $Radio
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Group1 = GUICtrlCreateGroup("总体", 72, 64, 505, 321)
$Group2 = GUICtrlCreateGroup("系统类", 120, 136, 201, 169)
$Radio = GUICtrlCreateRadio("IE修复", 144, 176, 65, 17)
GUICtrlSetState(-1, $Gui_Checked)
$Radio = GUICtrlCreateRadio("系统补丁", 240, 177, 73, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("输入法", 328, 136, 209, 169)
$Radio = GUICtrlCreateRadio("搜狗输入法", 351, 172, 89, 17)
$Radio = GUICtrlCreateRadio("五笔输入法", 452, 175, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio
_SetRadioState(0)
Case $Radio
_SetRadioState(1)
Case $Radio
_SetRadioState(3)
Case $Radio
_SetRadioState(2)
EndSwitch
WEnd
Func _SetRadioState($sID)
GUICtrlSetState($Radio[$RadioID], $Gui_unChecked)
$RadioID = $sID
GUICtrlSetState($Radio[$RadioID], $Gui_Checked)
EndFunc
这个刚好以前弄过,,,这应该就达到你的要求了. 分在同一个分组即可。 回复 8# user3000
谢谢这位兄弟,燃眉之急 8#很强大, GUICtrlCreateGroup 位置决定的。GUICreate("Form1", 623, 449)
GUICtrlCreateGroup("总体", 72, 64, 505, 321)
GUICtrlCreateGroup("系统类", 120, 136, 201, 169)
$Radio1 = GUICtrlCreateRadio("IE修复", 144, 176, 65, 17)
$Radio2 = GUICtrlCreateRadio("系统补丁", 240, 176, 73, 17)
$Radio3 = GUICtrlCreateRadio("搜狗输入法", 351, 176, 89, 17)
$Radio4 = GUICtrlCreateRadio("五笔输入法", 452, 176, 81, 17)
GUICtrlCreateGroup("输入法", 328, 136, 209, 169)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd 回复 12# afan
这个更给力啊。真给力楼主{:face (427):} #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Group1 = GUICtrlCreateGroup("总体", 72, 64, 505, 321)
$Group2 = GUICtrlCreateGroup("系统类", 120, 136, 201, 169)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("输入法", 328, 136, 209, 169)
GUIStartGroup()
$Radio1 = GUICtrlCreateRadio("IE修复", 144, 176, 65, 17)
$Radio2 = GUICtrlCreateRadio("系统补丁", 240, 177, 73, 17)
$Radio3 = GUICtrlCreateRadio("搜狗输入法", 351, 172, 89, 17)
$Radio4 = GUICtrlCreateRadio("五笔输入法", 452, 175, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
gzh888666 发表于 2011-12-20 22:48 http://www.autoitx.com/images/common/back.gif
第10行 GUIStartGroup() 纯属多余~
页:
[1]
2