我正在开发一个 AutoIt GUI,只是我自己的一个小示例框,我想知道如何将另一行文本添加到编辑框..
目前,(当我按下“按钮 1”时)编辑框显示:
'Button 1 was pressed'
但是当您按下另一个按钮时会重置。在不删除编辑框中已有的文本的情况下,我应该如何添加新的文本行?-提前致谢。
Opt("GUIOnEventMode", 1)
$Form2 = GUICreate("line trial", 552, 178, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore")
$editbox = GUICtrlCreateEdit("", 8, 8, 409, 169)
GUICtrlSetData(-1, "editbox")
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT)
GUICtrlSetOnEvent(-1, "editboxChange")
$Group1 = GUICtrlCreateGroup("Options", 424, 0, 121, 137)
$Button1 = GUICtrlCreateButton("Button1", 432, 16, 51, 17)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Button2", 432, 40, 51, 17)
GUICtrlSetOnEvent(-1, "Button2Click")
$Button3 = GUICtrlCreateButton("Button3", 432, 64, 51, 17)
GUICtrlSetOnEvent(-1, "Button3Click")
$Button4 = GUICtrlCreateButton("Button4", 432, 88, 51, 17)
GUICtrlSetOnEvent(-1, "Button4Click")
$Button5 = GUICtrlCreateButton("Button5", 432, 112, 51, 17)
GUICtrlSetOnEvent(-1, "Button5Click")
$Button6 = GUICtrlCreateButton("Button6", 488, 16, 51, 17)
GUICtrlSetOnEvent(-1, "Button6Click")
$Button7 = GUICtrlCreateButton("Button7", 488, 40, 51, 17)
GUICtrlSetOnEvent(-1, "Button7Click")
$Button8 = GUICtrlCreateButton("Button8", 488, 64, 51, 17)
GUICtrlSetOnEvent(-1, "Button8Click")
$Button9 = GUICtrlCreateButton("Button9", 488, 88, 51, 17)
GUICtrlSetOnEvent(-1, "Button9Click")
$Button10 = GUICtrlCreateButton("Button10", 488, 112, 51, 17)
GUICtrlSetOnEvent(-1, "Button10Click")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button11 = GUICtrlCreateButton("Exit", 424, 144, 59, 25)
GUICtrlSetOnEvent(-1, "Button11Click")
$Button12 = GUICtrlCreateButton("Clear", 496, 144, 51, 25)
GUICtrlSetOnEvent(-1, "Button12Click")
GUISetState(@SW_SHOW)
Global $File1 = "test.txt"
While 1
Sleep(100)
WEnd
Func Button10Click()
GUICtrlSetData($editbox, "Button 10 was pressed ")
FileWriteLine($File1, "Button 10 was pressed")
EndFunc
Func Button11Click()
If FileExists("test.txt") Then
FileDelete ( "test.txt" )
exit
Else
exit
EndIf
EndFunc
Func Button12Click()
GUICtrlSetData($editbox, "")
EndFunc
Func Button1Click()
GUICtrlSetData($editbox, "Button 1 was pressed")
FileWriteLine($File1, "Button 1 was pressed")
EndFunc
Func Button2Click()
GUICtrlSetData($editbox, "Button 2 was pressed ")
FileWriteLine($File1, "Button 2 was pressed")
EndFunc
Func Button3Click()
GUICtrlSetData($editbox, "Button 3 was pressed ")
FileWriteLine($File1, "Button 3 was pressed")
EndFunc
Func Button4Click()
GUICtrlSetData($editbox, "Button 4 was pressed ")
FileWriteLine($File1, "Button 4 was pressed")
EndFunc
Func Button5Click()
GUICtrlSetData($editbox, "Button 5 was pressed ")
FileWriteLine($File1, "Button 5 was pressed")
EndFunc
Func Button6Click()
GUICtrlSetData($editbox, "Button 6 was pressed ")
FileWriteLine($File1, "Button 6 was pressed")
EndFunc
Func Button7Click()
GUICtrlSetData($editbox, "Button 7 was pressed ", 1)
FileWriteLine($File1, "Button 7 was pressed")
EndFunc
Func Button8Click()
GUICtrlSetData($editbox, "Button 8 was pressed ")
FileWriteLine($File1, "Button 8 was pressed")
EndFunc
Func Button9Click()
GUICtrlSetData($editbox, "Button 9 was pressed
FileWriteLine($File1, "Button 9 was pressed")
EndFunc
Func editboxChange()
Global $editline1 = GUICtrlRead($editbox)
GUICtrlSetData($editbox, $editline1)
EndFunc
Func Form2Close()
exit
EndFunc