Jump to content

Input Mask on Input box


Recommended Posts

I have an input box...

$CollectSystemID = GUICtrlCreateInput('',100,20,100)

I would like to create some sort of "mask" for the input field. Ya know, if you have ever created an access database, they have input masks.

What I mean by all that is, the text that I am expecting in the field is in this format xxxx-xxxxxx-xx all alphanumerical, but there are hyphens inbetween those characters. Is there a way to do this?

Link to comment
Share on other sites

Maybe this will help or give you some idea. This works similar to other IP address input masks.

This is from the AutoIT help file, User Designed Functions. (_GUICtrlIpAddressCreate )

It looks like the user function itself calls the comctl32.dll to create the control and maybe uses the user32.dll to create the input structure. I do not understand all of the function code however so may be way off. The fact is that it works pretty good though...hopefully it helps with what you need.

#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $msg, $hgui, $button, $hIPAddress
    
    $hgui = GUICreate("IP Address Control Create Example", 300, 150)
    
    $hIPAddress = _GUICtrlIpAddressCreate ($hgui, 10, 10, 125, 30, $WS_THICKFRAME)
    
    $button = GUICtrlCreateButton("Exit", 100, 100, 100, 25)
    GUISetState(@SW_SHOW)
    
    While 1
        $msg = GUIGetMsg()
        
        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $button
                Exit
        EndSelect
    WEnd
EndFunc  ;==>_Main

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Link to comment
Share on other sites

I want neither, I want the text entered into the input field to be forced to the xxxx-xxxxxx-xx input mask. Basically, any text you enter will be by default hyphenated at those intervals. Anything that doesn't fulfill the entire mask will be denied. you know?

Link to comment
Share on other sites

I want neither, I want the text entered into the input field to be forced to the xxxx-xxxxxx-xx input mask. Basically, any text you enter will be by default hyphenated at those intervals. Anything that doesn't fulfill the entire mask will be denied. you know?

I think I understand more now. I don't know how to create input masks in AutoIt. However, the code I posted previously uses a user defined input mask. Perhaps that input mask code would help you move into a direction for creating one. As for the denying portion, that would be simple enough to create on your own after you get the input mask working.

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

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...