VadimKHL сказал(а):... Нужно что бы проходили только цифры...
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <UpdownConstants.au3>
Example1()
Example2()
Func Example1()
GUICreate('Example1', 200, 100)
$iInput = GUICtrlCreateInput('1', 50, 20, 100, 20, BitOR($ES_NUMBER, $ES_READONLY))
GUICtrlSetBkColor(-1, 0xFFFED8)
GUICtrlCreateUpdown(-1, $UDS_WRAP)
GUICtrlSetLimit(-1, 86, 1)
$iButton = GUICtrlCreateButton('Ok', 60, 60, 80)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop
Case $iButton
MsgBox(262144, Default, GUICtrlRead($iInput))
EndSwitch
WEnd
EndFunc ;==>Example1
Func Example2()
Local $iInput, $iButton, $sRead, $sReadPrev
GUICreate('Example2', 240, 140)
$iInput = GUICtrlCreateInput('', 70, 30, 100, 20, $ES_NUMBER)
GUICtrlSetBkColor(-1, 0xFFFED8)
GUICtrlSetLimit(-1, 2)
$iButton = GUICtrlCreateButton('Ok', 80, 80, 80)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $iButton
MsgBox(262144, Default, $sRead)
EndSwitch
$sRead = GUICtrlRead($iInput)
If (Not $sRead) Or ($sRead >= 1 And $sRead <= 86) Then
$sReadPrev = $sRead
Else
GUICtrlSetData($iInput, $sReadPrev)
EndIf
WEnd
EndFunc ;==>Example2
#include <EditConstants.au3>
GUICreate("Input", 300, 100)
$Inp = GUICtrlCreateInput("", 10, 10, 280, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
$Btn = GUICtrlCreateButton("OK", 120, 60, 60, 30)
GUISetState()
Do
Switch GUIGetMsg()
Case -3
Exit
Case $Btn
$s = GUICtrlRead($Inp)
If $s < 1 Or $s > 86 Then
MsgBox(0, "", "Error")
Else
MsgBox(0, "", "OK")
EndIf
EndSwitch
Until 0
к сожалению.InnI сказал(а):... не помешает $ES_READONLY.
If (Not $sRead) Or ($sRead >= 1 And $sRead <= 86) Then
If $s < 1 Or $s > 86 Then
If (Not $sRead)
VadimKHL сказал(а):... чем отличаются условия...
If (Not $sRead) Or ($sRead >= 1 And $sRead <= 86) Then ; Если поле в $iInput пустое ИЛИ число в $sRead входит за диапазон 1-86, то...
$sReadPrev = $sRead
Else ; Если $iInput не пустое поле И $sRead выходит за диапазон 1-86, то...
GUICtrlSetData($iInput, $sReadPrev)
EndIf
If $sRead And ($sRead < 1 Or $sRead > 86) Then ; Если $iInput не пустое поле И $sRead выходит за диапазон 1-86, то...
GUICtrlSetData($iInput, $sReadPrev)
Else ; Если поле в $iInput пустое ИЛИ число в $sRead входит за диапазон 1-86, то...
$sReadPrev = $sRead
EndIf