Erstellt ein (mehrzeiliges) Edit-Control für die GUI.
GUICtrlCreateEdit ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )
text | Die Beschriftung des Controls. |
left | Die linke Seite des Controls. Wird -1 verwendet, dann wird left mit Hilfe von GUICoordMode berechnet. |
top | Die Oberkante des Controls. Wird -1 verwendet, dann wird top mit Hilfe von GUICoordMode berechnet. |
width | [optional] Die Breite des Controls (voreingestellt ist die zuvor verwendete Breite). |
height | [optional] Die Höhe des Controls (voreingestellt ist die zuvor verwendete Höhe). |
style | [optional] Legt den Stil des Controls fest. Siehe Anhang GUI-Stile für Controls. Standard ( -1) : $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL Erzwungene Stile : $ES_MULTILINE, $WS_TABSTOP nur, wenn nicht $ES_READONLY |
exStyle | [optional] Legt den erweiterten Stil des Controls fest. Siehe Tabelle der erweiterten Stile. Standard ( -1) : $WS_EX_CLIENTEDGE |
Erfolg: | Die Identifikationsnummer (Control-ID) des neuen Controls zurück. |
Fehler: | 0. |
Um den Wert des Controls zu erhalten, siehe GUICtrlRead().
Um Informationen im Control zu setzen oder zu verändern, siehe GUICtrlUpdate...().
Um weitere Stile zusätzlich zum Standardstil zu verwenden, benutzt man BitOR($GUI_SS_DEFAULT_EDIT, newstyle, ... ).
Um die oben angegebenen Werte verwenden zu können, muss #include <EditConstants.au3> in das Skript eingefügt werden.
Wenn ein Dateiname per drag & drop auf dieses Control gezogen werden soll, verwendet man zusätzlich den erweiterten Stil WS_EX_ACCEPTFILES in GUICreate() und setzt den Status auf $GUI_DROPACCEPTED.
Mehrfachauswahlen von Dateien werden als getrennte Zeilen abgelegt.
Als Standard für das Verhalten des Controls (bzgl. Größe und/oder Position) bei Größenänderung der GUI gilt $GUI_DOCKAUTO. (Größe und Position werden entsprechend dem neuen Fenster angepasst.)
Mögliche Resizing-Parameter siehe GUICtrlSetResizing.
Das Erstellen eines RichEdit-Controls ist zu kompliziert, deshalb wird es nicht als Basis Control behandelt.
Hierfür muss man _GUICtrlRichEdit_Create() anwenden.
- - - - - - - - Erklärung der Controls - - - - - - - -
GUICoordMode (Option), GUICtrlRead, GUICtrlSetData, GUICtrlSetLimit, GUICtrlSetState, GUIGetMsg
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
GUICreate("Meine GUI mit einem Edit-Feld") ; Erstellt ein GUI-Fenster welches mittig ausgerichtet wird
Local $idMyedit = GUICtrlCreateEdit("Erste Zeile" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState(@SW_SHOW)
Send("{END}")
; Wird hinzugefügt, 3. Parameter nicht vergessen!
GUICtrlSetData($idMyedit, "Zweite Zeile", 1)
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $oMyError
RichEditExample()
; RichEdit-Control-Beispiel unter Nutzung von GUICtrlCreateObj
; Author: Klre Johansson
; AutoIt Version: 3.1.1.55
; Description: Very Simple example: Embedding RICHTEXT object
; Needs: MSCOMCT2.OCX in system32 but it's probably already there
; Date: 3 jul 2005
Func RichEditExample()
Local $oRP, $TagsPageC, $AboutC, $PrefsC, $StatC, $GUIActiveX, $msg
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")
GUICreate("Eingebettetes RICHTEXT", 320, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$TagsPageC = GUICtrlCreateLabel('Besuch der Tags-Seite', 5, 180, 100, 15, $SS_CENTER)
GUICtrlSetFont($TagsPageC, 9, 400, 4)
GUICtrlSetColor($TagsPageC, 0x0000ff)
GUICtrlSetCursor($TagsPageC, 0)
$AboutC = GUICtrlCreateButton('Über', 105, 177, 70, 20)
$PrefsC = GUICtrlCreateButton('Schriftgröße', 175, 177, 70, 20)
$StatC = GUICtrlCreateButton('leerer Stil', 245, 177, 70, 20)
$GUIActiveX = GUICtrlCreateObj($oRP, 10, 10, 400, 260)
GUICtrlSetPos($GUIActiveX, 10, 10, 300, 160)
With $oRP; ObjeKt tag Pool
.OLEDrag()
.Font = 'Arial'
.text = "Hallo - Au3 unterstützt ActiveX-Komponenten wie RICHTEXT. Dank an SvenP!" & @CRLF & 'Versuche etwas Text zu schreiben und ihn neu zu laden.'
;.FileName = @ScriptDir & '\RichText.rtf'
;.BackColor = 0xff00
EndWith
GUISetState(@SW_SHOW) ; GUI anzeigen
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
$oRP.SaveFile(@ScriptDir & "\RichText.rtf", 0)
ExitLoop
Case $msg = $TagsPageC
Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B7C8860-D78F-101B-B9B5-04021C009402}', '', @SW_HIDE)
Case $msg = $AboutC
$oRP.AboutBox()
Case $msg = $PrefsC
$oRP.SelFontSize = 12
Case $msg = $StatC
$oRP.SelBold = False
$oRP.SelItalic = False
$oRP.SelUnderline = False
$oRP.SelFontSize = 8
EndSelect
WEnd
GUIDelete()
EndFunc ;==>RichEditExample
Func MyErrFunc()
MsgBox($MB_SYSTEMMODAL, "AutoItCOM-Test", "Wir haben einen COM-Fehler abgefangen!" & @CRLF & @CRLF & _
"err.description: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _
"err.lastdllerror: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext: " & @TAB & $oMyError.helpcontext _
, 5)
; Wird nach 5 Sekunden automatisch fortfahren
Local $err = $oMyError.number
If $err = 0 Then $err = -1
SetError($err) ; Zu prüfen, bevor die Funktion endet
EndFunc ;==>MyErrFunc