使此后所有被創(chuàng)建的控件都?xì)w為一組.
GUIStartGroup ( [句柄] )
句柄 | [可選參數(shù)] 由 GUICreate 函數(shù)返回的窗口句柄 (默認(rèn)為先前使用的窗口). |
成功: | 返回 1. |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local
$button_1,
$radio_1,
$radio_2,
$radio_3
Local
$radio_4,
$radio_5,
$radio_6,
$input_1,
$input_2
Local
$radioval1,
$radioval2,
$msg
Opt("GUICoordMode", 1)
GUICreate("單選框分組演示", 400, 280)
;
創(chuàng)建控件
$button_1 = GUICtrlCreateButton("按鈕 1 &u", 30,
20, 120, 40)
GUICtrlCreateGroup("組框 1", 30, 90, 165, 160)
GUIStartGroup()
$radio_1 = GUICtrlCreateRadio("單選框 &0", 50, 120, 70, 20)
$radio_2 = GUICtrlCreateRadio("單選框 &1", 50, 150, 70, 20)
$radio_3 = GUICtrlCreateRadio("單選框 &2", 50, 180, 70, 20)
GUIStartGroup()
$radio_4 = GUICtrlCreateRadio("單選框 &A", 120, 120, 70, 20)
$radio_5 = GUICtrlCreateRadio("單選框 &B", 120, 150, 70, 20)
$radio_6 = GUICtrlCreateRadio("單選框 &C", 120, 180, 70, 20)
GUIStartGroup()
$input_1 = GUICtrlCreateInput("輸入框 1", 200, 20, 160, 30)
$input_2 = GUICtrlCreateInput("輸入框 2", 200, 70, 160, 30)
; 設(shè)置默認(rèn)值
(單選按鈕點(diǎn)擊, 默認(rèn)按鈕,等)
GUICtrlSetState($radio_1, $GUI_CHECKED)
GUICtrlSetState($radio_6, $GUI_CHECKED)
GUICtrlSetState($button_1, $GUI_FOCUS + $GUI_DEFBUTTON)
;
保持追蹤單選框事件
$radioval1 = 0 ; 設(shè)置 0 = 第一個(gè)單選按鈕, 2 =
最后一個(gè)按鈕
$radioval2 = 2
GUISetState()
; 在此消息循環(huán)中,
我們使用變量保持跟蹤單選框的變化,
; 另一種方式使用
GUICtrlRead() 讀取每個(gè)控件的狀態(tài).
;
這兩種方法都是同樣有效.
While
1
$msg = GUIGetMsg()
Select
Case $msg
= $GUI_EVENT_CLOSE
Exit
Case $msg
= $button_1
MsgBox(0,
"按鈕", "單選框 " & $radioval1 & @LF & "單選框
" & Chr($radioval2 + Asc("A")) & @LF & GUICtrlRead($input_1) & @LF & GUICtrlRead($input_2))
Case $msg
= $radio_1
Or $msg
= $radio_2
Or $msg
= $radio_3
$radioval1 = $msg - $radio_1
Case $msg
= $radio_4
Or $msg
= $radio_5
Or $msg
= $radio_6
$radioval2 = $msg - $radio_4
EndSelect
WEnd
EndFunc ;==>Example
provider with jb51.net (unicode) |