david7411 Posted January 4, 2008 Share Posted January 4, 2008 Hi Guys I appreciate if someone could help me or direction with GUICtrlCreateInput which is except only certain formatted input, for example, input for MAC address field have format of : 12-12-12-AA-1A-12 Thanks Link to comment Share on other sites More sharing options...
BrettF Posted January 4, 2008 Share Posted January 4, 2008 Could do it as they are typing with a constant regexp.... :| How I really don't know. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
covaks Posted January 5, 2008 Share Posted January 5, 2008 you'll have to adapt it for GuiCtrlCreateInput, but this regexp should work. Do $str = InputBox("","Enter MAC Address (XX-XX-XX-XX-XX-XX)") Until StringRegExp($str,"^(?:[[:xdigit:]]{2}[-]){5}[[:xdigit:]]{2}$",0) Link to comment Share on other sites More sharing options...
david7411 Posted January 6, 2008 Author Share Posted January 6, 2008 HiThanks for reply . The expression is very cool, but I am looking for something similar of GUICtrlCreateInput with style $ES_NUMBER , so user can type directly into input control.Is is possible ? Link to comment Share on other sites More sharing options...
Siao Posted January 6, 2008 Share Posted January 6, 2008 (edited) Question is, how elaborate do you want it to be. If you're ok with format checking done after user enters whole string/only when you actually need it, then you don't need much more than that RegExp (assuming it works fine). Read input when you need it, check with RegExp and notify user to try again if it doesn't match the correct pattern. If you want realtime checking, possibly preventing user entering illegal characters, but at the same time keep the thing convenient and not confusing for the user, then you could have 6 GUICtrlCreateInput controls and do the monitoring on each of them. That's the method M$ uses too, for example some CD key dialog, and even the common IP address control is actually 4 edits rolled into one. Or have 1 GUICtrlCreateInput, but it could get a bit messy. Anyway, for realtime checking, you'd need GuiRegisterMsg() WM_COMMAND, to catch EN_UPDATE notification. Search the forum with these keywords, there are a lot of examples. Edited January 6, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now