Что нового

Как вставлять текст с новой строки в графический элемент GUICtrlCreateEdit ?

agikon

Знающий
Сообщения
789
Репутация
17
Требуется чтобы при нажатии кнопок добавлся текст с новой строки, вот так http://postimage.org/image/qjgqppxpv/

А у меня с новой не добавляется и лишь заменяется.

Код:
#include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#include <GUIEdit.au3>

$GUI = GUICreate("", 200, 150)
GUISetState(@SW_SHOW, $GUI)


$forma1 = GUICtrlCreateEdit("", 10, 10, 50, 50, $ES_WANTRETURN)
$button1 = GUICtrlCreateButton('вставить 1', 80, 10, 80, 15)
$button2 = GUICtrlCreateButton('вставить 2', 80, 25, 80, 15)
$button3 = GUICtrlCreateButton('вставить 3', 80, 40, 80, 15)

While 1
    Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
        Case $button1
			$text1 = '1'
			$text10 = $text1 &@CRLF
			GUICtrlSetData($forma1, $text10)
        Case $button2
			$text2 = '2'
			$text20 = $text2 &@CRLF
			GUICtrlSetData($forma1, $text20)
        Case $button3
			$text3 = '3'
			$text30 = $text3 &@CRLF
			GUICtrlSetData($forma1, $text30)
	EndSwitch
WEnd

Подскажите пожалуйста.
 

Medic84

Омега
Команда форума
Администратор
Сообщения
1,590
Репутация
341
Код:
#include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#include <GUIEdit.au3>

$GUI = GUICreate("", 200, 150)
GUISetState(@SW_SHOW, $GUI)


$forma1 = GUICtrlCreateEdit("", 10, 10, 50, 50, $ES_WANTRETURN)
$button1 = GUICtrlCreateButton('вставить 1', 80, 10, 80, 15)
$button2 = GUICtrlCreateButton('вставить 2', 80, 25, 80, 15)
$button3 = GUICtrlCreateButton('вставить 3', 80, 40, 80, 15)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            $text1 = '1'
            $text10 = GUICtrlRead($forma1) & $text1 &@CRLF
            GUICtrlSetData($forma1, $text10)
        Case $button2
            $text2 = '2'
            $text20 = GUICtrlRead($forma1) & $text2 &@CRLF
            GUICtrlSetData($forma1, $text20)
        Case $button3
            $text3 = '3'
            $text30 = GUICtrlRead($forma1) & $text3 &@CRLF
            GUICtrlSetData($forma1, $text30)
    EndSwitch
WEnd
 
Верх