试试UDF
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ###
$Form1 = GUICreate("Form1", 252, 327, 192, 124, $WS_CAPTION)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 233, 257, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSetData(-1, "This is the default text.")
$Button1 = GUICtrlCreateButton("Start", 16, 280, 113, 33)
GUICtrlSetOnEvent(-1, "FillEvent")
$Button2 = GUICtrlCreateButton("Exit", 168, 280, 65, 33)
GUICtrlSetOnEvent(-1, "ExitEvent")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Debug_Ed = False ; 检查传递给 Edit 函数的类名, 设置为True,并使用另一个控件句柄,看看它的工作.
While 1
Sleep(10)
WEnd
Func FillEvent()
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetData($Edit1, "")
$i = 0
While($i < 20)
_GUICtrlEdit_AppendText($Edit1, @CRLF & "追加到最后")
;~ GUICtrlSetData($Edit1, "TestEdit...", -1)
;~ GUICtrlSetData($Edit1, "Ok" & @CRLF, -1)
$i += 1
Sleep(1000)
WEnd
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
EndFunc ;==>ConnectEvent
Func ExitEvent()
Exit 0
EndFunc ;==>ExitEvent
|