Jump to content

Putting A Limit On Text Boxes


Recommended Posts

Hi JPM

A few weeks ago i asked if it would be possible to put a limit on inputboxes. One guy cam up with a solution which you debated about implementing. I understood your point that it is up to the user to write code to error check. However I have been playing around and found that this would be a very useful addittion to autoit in the sense that i cannot find a way to do it from my end lol.

I need to enter a serial number or IP address I want to use input boxes to split the IP / Serial number. I need the text boxes to only allow a certain amount of charactors. I can and have done error checking once the user presses say the apply button but it would so much better if i could retrict the size on the charactor they enter.

Edited by vickerps
Link to comment
Share on other sites

Hi JPM

A few weeks ago i asked if it would be possible to put a limit on inputboxes. One guy cam up with a solution which you debated about implementing. I understood your point that it is up to the user to write code to error check. However I have been playing around and found that this would be a very useful addittion to autoit in the sense that i cannot find a way to do it from my end lol.

I need to enter a serial number or IP address I want to use input boxes to split the IP / Serial number. I need the text boxes to only allow a certain amount of charactors. I can and have done error checking once the user presses say the apply button but it would so much better if i could retrict the size on the charactor they enter.

Don't you think the following code is solving your problem?

Global $EM_LIMITTEXT  = 0x00C5

GUICreate("GUI limit input")
$ip0 = GUISetControl ("input", "", 10,  5, 25, 20)
GuiSendMsg($ip0,$EM_LIMITTEXT,3,0)

$ip1 = GUISetControl ("input", "", 40,  5, 25, 20)
GuiSendMsg($ip1,$EM_LIMITTEXT,3,0)

$ip2 = GUISetControl ("input", "", 70,  5, 25, 20)
GuiSendMsg($ip2,$EM_LIMITTEXT,3,0)

$ip3 = GUISetControl ("input", "", 100,  5, 25, 20)
GuiSendMsg($ip3,$EM_LIMITTEXT,3,0)

GuiWaitClose()
MsgBox (4096, "title", GUIRead($ip0), 2)
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...