title: Autoit add a line of text to an editbox
body: <p>I am working on an AutoIt GUI, just a little example box for myself and I was wondering how I would go about adding another line of text to an editbox..  </p>
  
  <p>Currently, (when I press 'Button 1') the editbox displays:  </p>
  
  <pre><code>'Button 1 was pressed'   
  </code></pre>
  
  <p>but resets when you press another button. How exactly should I go about adding a new line of text, without deleting the text already in the editbox?    -Thanks in advance.</p>
  
  <pre><code>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  
  </code></pre>