Sign in to follow this  
Followers 0
gianfun

GUICtrlCreateInput - maximum/minimum n° of digits

6 posts in this topic

I would like to know if it is possible to set a minimum/maximum number of digits/numbers when typing into a input box?

if i put

GUICreate("Test",200,200)

GUICtrlCreateInput("",100,100)

and i want it to be from 6-8 digits.

is there a way?

thanks

ps. i did search for it, but didnt find anything. probably searched wrong XD


My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote]

Share this post


Link to post
Share on other sites



I would like to know if it is possible to set a minimum/maximum number of digits/numbers when typing into a input box?

if i put

GUICreate("Test",200,200)

GUICtrlCreateInput("",100,100)

and i want it to be from 6-8 digits.

is there a way?

thanks

ps. i did search for it, but didnt find anything. probably searched wrong XD

Maybe...

GUICtrlSetLimit ( controlID, max [, min] )

Hope it helps,

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yep - Bert give you the solution fo it ... but you should be aware that: (from Help)

Parameters

controlID: The control identifier (controlID) as returned by a GUICtrlCreate... function.

max: For List controls it is the extent you can scroll horizontally in pixels.

For Input/Edit controls it is the max number of characters that can be entered.

min: [optional] For Slider and UpDown controls you can specify a min value.

.. you can use that "min" only for Slider and UpDown controls and not for Inputboxes (only max limit works there) Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

what a pity, i wanted it to be an exact number of digits long:(

but the

GUICtrlSetLimit ( controlID, max [, min] )

is good enough.

thanks Bert and enaiman


My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote]

Share this post


Link to post
Share on other sites

Yep - Bert give you the solution fo it ... but you should be aware that: (from Help)

.. you can use that "min" only for Slider and UpDown controls and not for Inputboxes (only max limit works there)

Hehehehee.... Opps. My Bad :whistle:

what a pity, i wanted it to be an exact number of digits long:(

but the

GUICtrlSetLimit ( controlID, max [, min] )

is good enough.

thanks Bert and enaiman

You could test the input??

#Include <GUIConstants.au3>

$gui = GUICreate("Test",200,200)
$input = GUICtrlCreateInput("",10,10, 180)
$button = GUICtrlCreateButton ("Test Input", 70, 35, 60)
GUICtrlSetLimit ($input, 8, 6)
GUISetState ()

While 1
    $msg = GuiGetMsg ()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button 
            _TestInput (GUICtrlRead($input))
    EndSelect
WEnd

Func _TestInput ($input)
    $len = StringLen ($input)
    If $len > 5 and $len < 9 Then
        Msgbox (0, "String OK", "")
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

THANKS !!


My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote]

Share this post


Link to post
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
Sign in to follow this  
Followers 0