找回密码
 加入
搜索
查看: 1204|回复: 2

如何做到选中后按确认健再执行?

[复制链接]
发表于 2009-4-17 09:31:05 | 显示全部楼层 |阅读模式
 
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)

Mainboard()
Func Mainboard()
        Local $radio1, $radio2, $radio3, $radio4, $msg, $top_pic, $font, $Button1, $Button2
        $font = "MS Sans Serif"
        
        GUICreate("Main Board Test",280,150) ; will create a dialog box that when displayed is centered
          $radio1 = GUICtrlCreateRadio("注销", 10, 50, 60, 20)
        GUICtrlSetFont(-1, 15, 200, 0, $font)
        $radio2 = GUICtrlCreateRadio("重起", 73, 50, 60, 20)
        GUICtrlSetFont(-1, 15, 200, 0, $font)
        $radio3 = GUICtrlCreateRadio("待机", 142, 50, 60, 20)
        GUICtrlSetFont(-1, 15, 200, 0, $font)
        $radio4 = GUICtrlCreateRadio("休眠", 205, 50, 60, 20)
        GUICtrlSetFont(-1, 15, 200, 0, $font)
        
        ;GUICtrlSetState($radio1, $GUI_CHECKED) ;默认选中引项
    
        $Button1 = GUICtrlCreateButton("确 定",142,90,60,20,0)        
    GUICtrlSetFont(-1, 10, 200, 0, $font)
    ;GUICtrlSetOnEvent(-1, "logoffClick")                

        $Button2 = GUICtrlCreateButton("关 闭",205,90,60,20,0)        
    GUICtrlSetFont(-1, 10, 200, 0, $font)
        ;GUICtrlSetOnEvent(-1, "Button2Click")
        
        GUISetFont(11, 400, 4)
    GUICtrlCreateLabel("Completion Time: 2009-03-25",10,125,200,15)

        GUISetState()      ; will display an  dialog box with 1 checkbox

        ; Run the GUI until the dialog is closed
        While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_CLOSE 
                                ExitLoop
                        Case $msg = $Button2        
                                ExitLoop
                        Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox(64, 'Info:', '注销')
                        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox(64, 'Info:', '重起')
                        Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox(64, 'Info:', '待机')
                        Case $msg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox(64, 'Info:', '休眠')        
                EndSelect
        WEnd
EndFunc   ;==>Mainboard



大侠们帮我看一下吧,现在只要选中其中的任何一个就立刻执行,我想让其在选中时不做任何动作,只有在点击确认后再执行,在此先谢谢了

[ 本帖最后由 hhasee 于 2009-4-17 11:03 编辑 ]
发表于 2009-4-17 10:37:44 | 显示全部楼层
While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button2   
                ExitLoop
            Case $msg = $Button1
            If BitAND(GUICtrlRead($radio1), $GUI_CHECKED) Then
                MsgBox(64, 'Info:', '注销')
            ElseIf BitAND(GUICtrlRead($radio2), $GUI_CHECKED) Then
                MsgBox(64, 'Info:', '重起')
            ElseIf BitAND(GUICtrlRead($radio3), $GUI_CHECKED) Then
                MsgBox(64, 'Info:', '待机')
            ElseIf BitAND(GUICtrlRead($radio4), $GUI_CHECKED) Then
                MsgBox(64, 'Info:', '休眠')   
            EndIf
        EndSelect
    WEnd
EndFunc
 楼主| 发表于 2009-4-17 11:03:08 | 显示全部楼层
太感谢了!终于解决了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 11:45 , Processed in 0.070943 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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