Hallo,
hab mal eine Frage wie man Inputboxen Sperren kann bei einem Knopf druck.
Hallo,
hab mal eine Frage wie man Inputboxen Sperren kann bei einem Knopf druck.
Mehr Infos bitte. Ist es die Standart Funktion InputBox oder hast du die InputBox mit einer GUI nachgebaut?
Hab 2 Inputboxen via Koda gemacht.
[autoit]...
$time = GUICtrlCreateInput("", 104, 54, 33, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$hotkey= GUICtrlCreateInput("", 104, 96, 33, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
GUICtrlSetLimit(-1, 1)
...
Mit
[autoit]GUICtrlSetStyle
[/autoit]und
[autoit]$ES_READONLY
[/autoit]Lieg ich da richtig
[autoit]...
GUICtrlSetState($time, $ES_READONLY)
GUICtrlSetState($hotkey, $ES_READONLY)
...
Wie entsperr ich die Inputbox dann ?
ich würds so machen:
[autoit]GUICtrlSetState($CONTROLID, 128) ; zum sperren
GUICtrlSetState($CONTROLID, 64) ; zum entsperren
Hier:
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 140, 146, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 121, 21)
$sperren = GUICtrlCreateButton("sperren", 8, 40, 75, 25, $WS_GROUP)
$entsperren = GUICtrlCreateButton("entsperren", 8, 72, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $sperren
GUICtrlSetStyle($Input1, $ES_READONLY)
Case $entsperren
GUICtrlSetStyle($Input1, "")
EndSwitch
WEnd
Hi,
ich hab dir mal ein kleines Bsp gemacht:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 633, 454, 271, 155)
$Input1 = GUICtrlCreateInput("lalala", 176, 64, 169, 21)
$Button1 = GUICtrlCreateButton("Sperren", 176, 88, 169, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Switch GUICtrlRead($Button1)
Case "Sperren"
GUICtrlSetStyle($Input1, $ES_READONLY)
GUICtrlSetData($Button1, "Entsperren")
Case "Entsperren"
GUICtrlSetStyle($Input1, 0)
GUICtrlSetData($Button1, "Sperren")
EndSwitch
EndSwitch
WEnd
//Edit: Zu langsam ![]()
![]()
Krieg folgenen Fehler
[autoit]ERROR: $CONTROLID: undeclared global variable.
GUICtrlSetState($time, $CONTROLID,
Weil GUICtrlSetState in dem Fall auch nicht das richtige ist. Nimm wie in den beiden Beispielen GUICtrlSetStyle. Wenn aber doch das State nehmen willst dann must das $CONTROLID durch das $time ersetzen.
[autoit]GUICtrlSetState($time, 128) ; zum sperren
GUICtrlSetState($time, 64) ; zum entsperren
Danke dir! Klapp alles ...