Setzt den Text eines Buttons
#include <GuiButton.au3>
_GUICtrlButton_SetText ( $hWnd, $sText )
$hWnd | Control-ID / Handle des Controls |
$sText | Neuer Text |
Erfolg: | True |
Fehler: | False |
- - - - - - - - Erklärung der Controls - - - - - - - -
#include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Global $g_idMemo
Example()
Func Example()
Local $y = 70, $a_idBtn[6], $iRand
GUICreate("Buttons", 510, 400)
$g_idMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, 0)
GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)
$a_idBtn[0] = GUICtrlCreateButton("Button 1", 10, 10, 90, 50)
For $x = 1 To 5
$a_idBtn[$x] = GUICtrlCreateButton("Button " & $x + 1, 10, $y, 90, 50)
$y += 60
Next
$iRand = Random(0, 5, 1)
MsgBox($MB_SYSTEMMODAL, "Information", "Setzt den Text von Button " & $iRand + 1)
_GUICtrlButton_SetText($a_idBtn[$iRand], "Neuer Text " & $iRand + 1)
For $x = 0 To 5
MemoWrite("$a_idBtn[" & $x & "] Text: " & _GUICtrlButton_GetText($a_idBtn[$x]))
Next
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Exit
EndFunc ;==>Example
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage)
GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite