找回密码
 加入
搜索
查看: 2919|回复: 5

[AU3基础] [已解决]radio或checkbox如何成对建立?

  [复制链接]
发表于 2012-5-23 13:10:21 | 显示全部楼层 |阅读模式
本帖最后由 showshow 于 2012-5-25 08:17 编辑

可能问题没描述清楚,

想在GUI上创建多组radio按钮,组与组之间的选取不干扰

就如radio1,radio2成一组形成单选(选中radio1就取消选中radio2)
    radio3,radio4成一组形成单选(选中radio3就取消选中radio4)
    .....
      .....
以次类推,最重要的是组与组之间的选取不干扰,不知可否实现?

或者checkbox也可以~

=======感谢楼下3位大虾==========
发表于 2012-5-23 14:50:36 | 显示全部楼层
回复 1# showshow


    半天没人回应楼主, 那么我应一声:
请查阅 GuiCtrlCreatGroup 函数

楼下继续来人接力?

评分

参与人数 1贡献 +4 收起 理由
showshow + 4 学习了

查看全部评分

发表于 2012-5-23 14:58:16 | 显示全部楼层
[au3]#include <GUIConstantsEx.au3>

Example()

Func Example()
        GUICreate("My GUI group") ; will create a dialog box that when displayed is centered

        Local $x = 10, $y = 10, $w = 50, $h = 16
        For $i = 1 To 6
                GUICtrlCreateRadio(2 * $i, $i*$x*5, $y + 2, $w, $h)
                GUICtrlCreateRadio(2 * $i + 1, $i*$x*5, $y + 22, $w, $h)
                GUICtrlCreateGroup('', -99, -99, 1, 1)
        Next
        GUISetState() ; will display an empty dialog box

        ; Run the GUI until the dialog is closed
        While 1
                Local $msg = GUIGetMsg()

                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd
EndFunc   ;==>Example
[/au3]

评分

参与人数 1贡献 +3 收起 理由
showshow + 3 学习了~

查看全部评分

发表于 2012-5-23 20:07:24 | 显示全部楼层
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 232, 186, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 24, 16, 89, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 24, 48, 89, 25)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 24, 88, 89, 25)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 24, 128, 89, 25)
GUISetOnEvent(-3, "gui")
GUICtrlSetOnEvent($Checkbox1, "gui")
GUICtrlSetOnEvent($Checkbox2, "gui")
GUICtrlSetOnEvent($Checkbox3, "gui")
GUICtrlSetOnEvent($Checkbox4, "gui")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1        
        Sleep(100)
WEnd

Func gui()
    Switch @GUI_CtrlId
        Case -3
            Exit
        Case $Checkbox1 To $Checkbox2
            DllCall("user32.dll","Int","CheckRadioButton","hwnd",$Form1,"Int",$Checkbox1,"Int",$Checkbox2,"Int",@GUI_CtrlId)
        Case $Checkbox3 To $Checkbox4
           DllCall("user32.dll","Int","CheckRadioButton","hwnd",$Form1,"Int",$Checkbox3,"Int",$Checkbox4,"Int",@GUI_CtrlId)
    EndSwitch
EndFunc 

评分

参与人数 1贡献 +3 收起 理由
showshow + 3 厉害~

查看全部评分

发表于 2013-12-4 15:15:24 | 显示全部楼层
好东西,正好用了
发表于 2013-12-4 16:22:43 | 显示全部楼层
这个方法不错哈。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 17:36 , Processed in 0.105135 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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