找回密码
 加入
搜索
查看: 8393|回复: 16

[GUI管理] 怎么在2个GUICtrlCreateGroup组中同时只能选在一个按钮选项呢(已解决)

 火.. [复制链接]
发表于 2011-12-20 16:14:18 | 显示全部楼层 |阅读模式
本帖最后由 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个或者更多
图片如下:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-12-20 16:18:04 | 显示全部楼层
分组本身作用就是这样,要么做成同一个组,要么动态分配另外那个组
 楼主| 发表于 2011-12-20 16:19:07 | 显示全部楼层
回复 2# Qokelate
我想问下那怎么动态分组呢
发表于 2011-12-20 16:24:12 | 显示全部楼层
选择一个Radio后,设置另一个组的Radio为未选中状态
 楼主| 发表于 2011-12-20 16:36:27 | 显示全部楼层
回复 4# Qokelate


    不知道大虾能不能给具体些代码,谢谢了
发表于 2011-12-20 16:59:35 | 显示全部楼层
参考GUIStartGroup
发表于 2011-12-20 17:28:53 | 显示全部楼层
学习学习,留个脚印
发表于 2011-12-20 18:24:36 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $RadioID = 0, $Radio[4]
#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[0] = GUICtrlCreateRadio("IE修复", 144, 176, 65, 17)
GUICtrlSetState(-1, $Gui_Checked)
$Radio[1] = GUICtrlCreateRadio("系统补丁", 240, 177, 73, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("输入法", 328, 136, 209, 169)
$Radio[2] = GUICtrlCreateRadio("搜狗输入法", 351, 172, 89, 17)
$Radio[3] = 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[0]
                                                _SetRadioState(0)
                                        Case $Radio[1]
                                                _SetRadioState(1)
                                        Case $Radio[3]
                                                _SetRadioState(3)
                                        Case $Radio[2]
                                                _SetRadioState(2)
        
        EndSwitch
WEnd
        
Func _SetRadioState($sID)
        GUICtrlSetState($Radio[$RadioID], $Gui_unChecked)
        $RadioID = $sID
        GUICtrlSetState($Radio[$RadioID], $Gui_Checked)
EndFunc 

这个刚好以前弄过,,,这应该就达到你的要求了.
发表于 2011-12-20 18:57:15 | 显示全部楼层
分在同一个分组即可。
 楼主| 发表于 2011-12-20 19:03:17 | 显示全部楼层
回复 8# user3000


    谢谢这位兄弟,燃眉之急
发表于 2011-12-20 20:11:26 | 显示全部楼层
8#很强大,
发表于 2011-12-20 21:26:52 | 显示全部楼层
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
 楼主| 发表于 2011-12-20 21:44:43 | 显示全部楼层
回复 12# afan
这个更给力啊。真给力楼主
发表于 2011-12-20 22:48:11 | 显示全部楼层
#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
发表于 2011-12-20 23:34:57 | 显示全部楼层
gzh888666 发表于 2011-12-20 22:48



    第10行 GUIStartGroup() 纯属多余~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 23:34 , Processed in 0.117056 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表