找回密码
 加入
搜索
楼主: 邪恶海盗

[AU3基础] [已解决]关于检测GUICtrlCreateRadio状态并执行相应的代码的用法,求指导

 火.. [复制链接]
 楼主| 发表于 2012-4-17 21:29:38 | 显示全部楼层
回复 15# netegg


研究了好久还没搞明白...   
发表于 2012-4-17 21:48:49 | 显示全部楼层
本帖最后由 netegg 于 2012-4-17 22:37 编辑

回复 16# 邪恶海盗 [au3]#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$input1 = GUICtrlCreateInput("Input1", 88, 48, 73, 21)
$Group1 = GUICtrlCreateGroup("Group1", 200, 24, 73, 65)
$radio1 = GUICtrlCreateRadio("Radio1", 208, 26, 113, 17)
$radio2 = GUICtrlCreateRadio("Radio2", 208, 40, 113, 17)
$radio3 = GUICtrlCreateRadio("Radio3", 208, 56, 113, 17)
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 $radio1
                        If BitAND(guictrlread($radio1),$gui_checked) then
                              guictrlsetstate($radio2, $gui_unchecked)
                              guictrlsetstate($radio3, $gui_unchecked)
                               guictrlsetdata($input1, '1')
                        endif
                case $radio2
                        if bitand(guictrlread($radio2),$gui_checked) then
                              guictrlsetstate($radio1, $gui_unchecked)
                              guictrlsetstate($radio3, $gui_unchecked)
                               guictrlsetdata($input1, '2')
                       endif
                case $radio3
                        if bitand(guictrlread($radio3),$gui_checked) then
                              guictrlsetstate($radio1, $gui_unchecked)
                              guictrlsetstate($radio2, $gui_unchecked)
                               guictrlsetdata($input1, '3')
                       endif
        EndSwitch
WEnd[/au3]
发表于 2012-4-17 23:00:51 | 显示全部楼层
回复 17# netegg


    蛋蛋喝高了…
GUICreate('Example', 270, 215)
$iRadio1 = GUICtrlCreateRadio('方式一', 32, 65)
$iRadio2 = GUICtrlCreateRadio('方式二', 105, 65)
$iRadio3 = GUICtrlCreateRadio('方式三', 168, 65)
GUICtrlSetState($iRadio1, 1)
$iInput = GUICtrlCreateInput(5, 31, 85, 165, 20)
GUISetState()

While 1
        $Msg = GUIGetMsg()
        Switch $Msg
                Case -3
                        Exit
                Case $iRadio1 To $iRadio3
                        GUICtrlSetData($iInput, $Msg + 2)

        EndSwitch
WEnd
发表于 2012-4-17 23:04:21 | 显示全部楼层
本帖最后由 netegg 于 2012-4-17 23:07 编辑

回复 18# afan
那倒没有,那段代码其实不是给楼主的,我想的是三个单选如果相关性不是很强(类似使用复选来进行单选)的情况,也就是需要独立操作来指定
发表于 2012-4-17 23:08:42 | 显示全部楼层
回复  afan
那倒没有,那段代码其实不是给楼主的,我想的是三个单选如果相关性不是很强的情况,也就是需要 ...
netegg 发表于 2012-4-17 23:04



     你都 CreateGroup 了,它们不相干也真心相爱了~

评分

参与人数 1金钱 +11 收起 理由
user3000 + 11 够风趣的!

查看全部评分

发表于 2012-4-17 23:09:47 | 显示全部楼层
回复 20# afan
这个倒确实
 楼主| 发表于 2012-4-19 19:08:41 | 显示全部楼层
本帖最后由 邪恶海盗 于 2012-4-19 19:11 编辑

回复 17# netegg


    为什么要用和来判断???

我尝试过直接判断三个控件的状态,没有成功,今天再检查一下发现其中有错误的地方,修正下就好了...
#include <GUIConstantsEx.au3>
#NoTrayIcon
#Region ### START Koda GUI section ### Form=

$WinMain = GUICreate("Example", 270, 215)
$e1 = ("5")
$e2 = ("6")
$e3 = ("7")
$Radio1 = GUICtrlCreateRadio("方式一", 32, 65)
$Radio2 = GUICtrlCreateRadio("方式二", 105, 65)
$Radio3 = GUICtrlCreateRadio("方式三", 168, 65)
GUICtrlSetState($Radio1, $GUI_CHECKED)

$sinput = GUICtrlCreateInput("22", 31, 85, 165, 30)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Radio1 
                        If GUICtrlRead($Radio1) = $GUI_CHECKED Then GUICtrlSetData($sinput, $e1)
                Case $Radio2 
                        If GUICtrlRead($Radio2) = $GUI_CHECKED Then        GUICtrlSetData($sinput, $e2)
                Case $Radio3 
                        If GUICtrlRead($Radio3) = $GUI_CHECKED Then        GUICtrlSetData($sinput, $e3)
        EndSwitch
WEnd
发表于 2012-4-19 19:27:01 | 显示全部楼层
本帖最后由 netegg 于 2012-4-19 19:30 编辑

回复 22# 邪恶海盗
只有在组里,单选才会切换,不在组是独立的,只有点击选中,切换不了
 楼主| 发表于 2012-4-19 20:09:40 | 显示全部楼层
回复 23# netegg


没看明白, 22#点击了是可以切换的,麻烦解释一下...

另外,If $CmdLine[0] > 0 And $CmdLine[1] = '/s' Then Exit _ax()可以直接控制程序执行一个自定义函数,如果要执行两个咋整???
 楼主| 发表于 2012-4-19 20:31:43 | 显示全部楼层
回复  netegg


没看明白, 22#点击了是可以切换的,麻烦解释一下...

另外,If $CmdLine[0] > 0 And $C ...
邪恶海盗 发表于 2012-4-19 20:09



    用笨办法,再自定义一个函数,内容是运行两个自定义函数

If $CmdLine[0] > 0 And $CmdLine[1] = '/s' Then Exit _ax()

Func ax()
_ay()
_az()
EndFunc
发表于 2012-4-20 10:14:33 | 显示全部楼层
我说,楼主该结贴了吧》
发表于 2012-4-20 17:03:09 | 显示全部楼层
当成button控件写事件即可
 楼主| 发表于 2012-4-21 19:36:31 | 显示全部楼层
我说,楼主该结贴了吧》
魔导 发表于 2012-4-20 10:14



   这两天 断网了...

结帖...
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-17 06:35 , Processed in 0.068643 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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