变量基础问题。。。。
$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的状态,这个变量似乎被我变成了常量,该如何解决,望大家指教 如果上面$r1-$r5用数组,在CASE里又该如何写? #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
;~ $Ra = GUICtrlCreateRadio("", 325, 90, 55, 17)
;~ $Ra = GUICtrlCreateRadio("", 380, 90, 55, 17)
;~ $Ra = GUICtrlCreateRadio("", 325, 110, 55, 17)
;~ $Ra = GUICtrlCreateRadio("", 380, 110, 55, 17)
;~ $Ra = GUICtrlCreateRadio("", 325, 130, 55, 17)
;~ GUISetState(@SW_SHOW)
;~ While 1
;~ $nMsg = GUIGetMsg()
;~ Switch $nMsg
;~ Case $Ra To $Ra
;~ 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
页:
[1]