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

[AU3基础] 变量基础问题。。。。

[复制链接]
发表于 2014-4-29 03:30:21 | 显示全部楼层 |阅读模式
$Ra1 = GUICtrlCreateRadio("", 325, 90, 55, 17)
$Ra2 = GUICtrlCreateRadio("", 380, 90, 55, 17)
$Ra3 =GUICtrlCreateRadio("", 325, 110, 55, 17)
$Ra4 =GUICtrlCreateRadio("", 380, 110, 55, 17)
$Ra5 =GUICtrlCreateRadio("", 325, 130, 55, 17)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
        case $ra1,$ra2,$ra3,$ra4,$ra5
        for $i=1 to 5 Step 1
        Local $x="$ra"&$i
          MsgBox(0,$x,GUICtrlRead($x))
        Next
        MsgBox(0,"$ra"&$i,$xx)
            Case $GUI_EVENT_CLOSE

                Exit
                        EndSwitch
我也不知道这属于啥问题该上哪查帮助,GUICtrlRead($x)始终不能正确显示$ra1-5的状态,这个变量似乎被我变成了常量,该如何解决,望大家指教
 楼主| 发表于 2014-4-29 03:34:43 | 显示全部楼层
如果上面$r1-$r5用数组,在CASE里又该如何写?
发表于 2014-4-29 07:45:54 | 显示全部楼层
#include <GUIConstantsEx.au3>

GUICreate("GUI")
$Ra1 = GUICtrlCreateRadio("", 325, 90, 55, 17)
$Ra2 = GUICtrlCreateRadio("", 380, 90, 55, 17)
$Ra3 = GUICtrlCreateRadio("", 325, 110, 55, 17)
$Ra4 = GUICtrlCreateRadio("", 380, 110, 55, 17)
$Ra5 = GUICtrlCreateRadio("", 325, 130, 55, 17)

GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Ra1, $Ra2, $Ra3, $Ra4, $Ra5
                        For $i = 1 To 5 Step 1
                                Local $x = "ra" & $i
                                MsgBox(0, $x, BitAND(GUICtrlRead(Eval($x)), $GUI_CHECKED))
                        Next
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd


;~ #include <GUIConstantsEx.au3>

;~ GUICreate("GUI")

;~ Local $Ra[6]
;~ $Ra[1] = GUICtrlCreateRadio("", 325, 90, 55, 17)
;~ $Ra[2] = GUICtrlCreateRadio("", 380, 90, 55, 17)
;~ $Ra[3] = GUICtrlCreateRadio("", 325, 110, 55, 17)
;~ $Ra[4] = GUICtrlCreateRadio("", 380, 110, 55, 17)
;~ $Ra[5] = GUICtrlCreateRadio("", 325, 130, 55, 17)

;~ GUISetState(@SW_SHOW)

;~ While 1
;~         $nMsg = GUIGetMsg()
;~         Switch $nMsg
;~                 Case $Ra[1] To $Ra[5]
;~                         For $i = 1 To 5
;~                                 Local $x = $Ra[$i]
;~                                 MsgBox(0, $i, BitAND(GUICtrlRead($x), $GUI_CHECKED))
;~                         Next
;~                 Case $GUI_EVENT_CLOSE
;~                         Exit
;~         EndSwitch
;~ WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-7-8 10:20 , Processed in 0.068150 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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