44 lines
1.9 KiB
AutoIt
44 lines
1.9 KiB
AutoIt
#include <ButtonConstants.au3>
|
|
#include <EditConstants.au3>
|
|
#include <GUIConstantsEx.au3>
|
|
#include <WindowsConstants.au3>
|
|
#include <GuiRichEdit.au3>
|
|
#include <Color.au3>
|
|
|
|
#Region ### START Koda GUI section ### Form=
|
|
$Form1 = GUICreate("Form1", 345, 290, 192, 124)
|
|
$hRichEdit = _GUICtrlRichEdit_Create($Form1, "", 40, 16, 273, 175, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL,$ES_NOHIDESEL))
|
|
$Input1 = GUICtrlCreateInput("[Account]", 40, 202, 121, 21)
|
|
$Input2 = GUICtrlCreateInput("mein text", 40, 232, 121, 21)
|
|
$Input3 = GUICtrlCreateInput("zusatz", 40, 262, 121, 21)
|
|
$Button1 = GUICtrlCreateButton("Button1", 192, 232, 75, 25, $WS_GROUP)
|
|
GUISetState(@SW_SHOW)
|
|
#EndRegion ### END Koda GUI section ###
|
|
|
|
While 1
|
|
$nMsg = GUIGetMsg()
|
|
Switch $nMsg
|
|
Case $GUI_EVENT_CLOSE
|
|
Exit
|
|
Case $Button1
|
|
_GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
|
|
_GUICtrlRichEdit_AppendText($hRichEdit,GUICtrlRead($Input1))
|
|
_RichEdit_AddColoredText($hRichEdit, GUICtrlRead($Input2), 0xFF0000)
|
|
_RichEdit_AddColoredText($hRichEdit,"|", 0x000000)
|
|
_RichEdit_AddColoredText($hRichEdit,GUICtrlRead($Input3), 0x00FF00)
|
|
_RichEdit_AddColoredText($hRichEdit, @CR, 0x000000)
|
|
EndSwitch
|
|
WEnd
|
|
|
|
|
|
|
|
Func _RichEdit_AddColoredText($hRichEdit, $sText, $nColor)
|
|
;SEuBo
|
|
Local $aSel, $aNSel
|
|
$aSel = _GUICtrlRichEdit_GetSel($hRichEdit) ; aktuelle Cursorpos.
|
|
_GUICtrlRichEdit_AppendText($hRichEdit, $sText) ; Text ahängen
|
|
$aNSel = _GUICtrlRichEdit_GetSel($hRichEdit) ; Cursorpos nach dem Text einfügen
|
|
_GUICtrlRichEdit_SetSel($hRichEdit, $aSel[0], $aNSel[0], True) ; Geschriebenen Text wählen
|
|
_GUICtrlRichEdit_SetCharColor($hRichEdit, $nColor) ; Einfärben
|
|
_GUICtrlRichEdit_SetSel($hRichEdit, -1, -1) ; Und cursor ans ende setzen
|
|
EndFunc ;==>_RichEdit_AddColoredText |