找回密码
 加入
搜索
查看: 3799|回复: 6

[AU3基础] 选择radio的后按钮不起作用(已解决)

  [复制链接]
发表于 2010-4-27 22:01:52 | 显示全部楼层 |阅读模式
本帖最后由 auhj887 于 2010-4-29 11:41 编辑

看了论坛好几天,模仿做了一个选择打开Autoit帮助的小程序,不知道,为什么点击radio选择后,点按钮不不起作用,请大家帮看看。。。。谢谢

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 202, 255, 199, 177)
GUICtrlSetOnEvent(-1, "Form1Close")
$Radio1 = GUICtrlCreateRadio("Radio1", 40, 40, 113, 17)
GUICtrlSetOnEvent(-1, "rd_1")
$Radio2 = GUICtrlCreateRadio("Radio2", 40, 80, 113, 17)
GUICtrlSetOnEvent(-1, "rd_2")
$Button1 = GUICtrlCreateButton("Button1", 40, 176, 105, 41)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $radio1, $radio2, $msg
While 1
        $nMsg = GUIGetMsg()
            Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                  Exit                                       
                          Case $Button1
                                If GUICtrlRead( $Radio1 ) = 1 Then
                            rd_1()        
                            ElseIf GUICtrlRead( $Radio2 ) = 1 Then
                    rd_2()
                            Else   
                                endif
                                Button1Click()
                            
        EndSwitch
Wend

Func rd_1()
ControlCommand ("AutoIt Help", "", "[ID:1001]", "SelectString", 'control')       
EndFunc       

Func rd_2()
ControlCommand ("AutoIt Help", "", "[ID:1001]", "SelectString", '字符串')       
EndFunc       

Func Button1Click()
ControlClick("AutoIt Help","","[ID:1006]","")
EndFunc       

Func Form1Close()
Exit
EndFunc
发表于 2010-4-27 22:46:16 | 显示全部楼层
怎么又有消息模式 又有事件模式???
你到底用哪种哦?
发表于 2010-4-28 05:51:19 | 显示全部楼层
If GUICtrlRead( $Radio1 ) == 1 Then
 楼主| 发表于 2010-4-28 06:22:26 | 显示全部楼层
回复 2# 水木子

我的目的是搜索下拉框选择对应字符串以后,按列出主题按钮。想以事件模式
发表于 2010-4-28 06:49:06 | 显示全部楼层
楼主先把书写习惯培养好再写代码吧
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        If GUICtrlRead( $Radio1 ) = 1 Then
                                rd_1()
                        Else
                                If GUICtrlRead( $Radio2 ) = 1 Then
                                        rd_2()
                                Else             --------->没想明白这句的用处
                                Endif
                        [Endif]                    --------->原来的这里差一句
                        Button1Click()
        EndSwitch
Wend
按你的代码,是不是这样?
发表于 2010-4-28 09:11:45 | 显示全部楼层
楼主代码看了让人蛋疼
 楼主| 发表于 2010-4-28 15:42:56 | 显示全部楼层
本帖最后由 auhj887 于 2010-4-28 16:33 编辑

谢谢netegg, 应该好好检查。。。。。。。。
如何用input向命令中的‘contol’赋值
ControlCommand ("AutoIt Help", "", "[ID:1001]", "SelectString", 'control')      。。。。。谢谢各位的指导
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-4 16:31 , Processed in 0.155011 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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