Jump to content

Int limit on Input?


Recommended Posts

Is it possible to set an int limit on an input?.. so when useing Beep() the user would only be able to input integeres between those 37 to 32767.

Possible?

EDIT: and how do i make the Combo readonly?

Edited by Wb-FreeKill
Link to comment
Share on other sites

before your edit....

this is how i keep the integeres.. sample code with input/checking

#include <GUIConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <String.au3>



$My_GUI=GUICreate("My GUI",400,200,50,50)
$Button1= GUICtrlCreateButton("Note", 30,30,100,30)
GUICtrlCreateLabel("This is a Music/Tone testing program", 50,140)

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button1
            Call("Set_num")
    EndSelect
WEnd


Func Set_num()
$Num_ans = InputBox("Set Music Notes", "Please Type a number for the Tone ie..." & @CRLF & @CRLF & " From 37 to 37767 " & @CRLF & @CRLF & " 75 or 100 or ? ", "", "", "", "", -1, -1, 15)
    Select
        Case @error = 0;OK - The string returned is valid
            If $Num_ans > 37 And $Num_ans < 37767 Then
                Beep($Num_ans)
                Sleep(20)
            Else
                MsgBox(64, "Sorry!", " Please use numbers ONLY from " & @CRLF & @CRLF & " 37 to 37767... 45, 65, etc ")
            EndIf
            
        Case @error = 1;The Cancel button was pushed
            
        Case @error = 2;The Timeout time was reached
            
        Case @error = 3;The InputBox failed to open
            
        EndSelect
EndFunc

hope it helps

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...