用事件模式会方便很多;另外子窗口可以采用先创建,之后都用显隐的方式切换更方便。
当然,你的想法也可以实现
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Global $idRadio_1, $idRadio_2, $idRadio_3, $iBfID
Example()
Func Example()
Opt("GUICoordMode", 1)
GUICreate("", 400, 280)
Local $idButton_1 = GUICtrlCreateButton("按钮 1 &u", 30, 20, 120, 40)
GUICtrlCreateGroup("组框 1", 30, 90, 165, 160)
GUIStartGroup()
$idRadio_1 = GUICtrlCreateRadio("单选框 &0", 50, 120, 90, 20)
$idRadio_2 = GUICtrlCreateRadio("单选框 &1", 50, 150, 90, 20)
$idRadio_3 = GUICtrlCreateRadio("单选框 &2", 50, 180, 90, 20)
GUISetState(@SW_SHOW)
Local $idMsg = 0
While 1
$idMsg = GUIGetMsg()
Switch $idMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton_1
Case $idRadio_1, $idRadio_2, $idRadio_3
$iBfID = $idMsg
GuiNew("单选框 " & String($idMsg - $idRadio_1))
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example
Func GuiNew($GTitle)
Local $hGUI = GUICreate($GTitle, -1, 216, -1, 5)
GUISetState(@SW_SHOW, $hGUI)
Local $stt = ''
While 1
$idMsg = GUIGetMsg()
Switch $idMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idRadio_1, $idRadio_2, $idRadio_3
If $idMsg = $iBfID Then ContinueCase
$iBfID = $idMsg
$stt = "单选框 " & ($idMsg - $idRadio_1)
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
If $stt <> '' Then GuiNew($stt)
EndFunc ;==>GuiNew
|