autoitxp Posted March 23, 2008 Posted March 23, 2008 (edited) Hi how to set limit of special char in GUICtrlCreateInput i dont want " _ + = ., /@ " user to input how to do that ? IF someone try to put these chars msg should prompt that u cannot use these chars like web form do hELP ! Edited March 23, 2008 by autoitxp
Nahuel Posted March 23, 2008 Posted March 23, 2008 If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") Return; or ContinueLoop or ContinueCase or whatever keyword to skip the next steps. endif
autoitxp Posted March 24, 2008 Author Posted March 24, 2008 (edited) Well i tryed this but not working for me can u put some working example $Input = GUICtrlCreateInput ("@+" , $inputleft, 140, $inputwidth, $inputheight) Func _check() If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") endif EndFunc Edited March 24, 2008 by autoitxp
Swift Posted March 24, 2008 Posted March 24, 2008 $Input = GUICtrlCreateInput ("@+" , $inputleft, 140, $inputwidth, $inputheight) Func _check() If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") Return endif EndFunc
monoceres Posted March 24, 2008 Posted March 24, 2008 (edited) You must loop the _check function: $Input = GUICtrlCreateInput ("@+" , $inputleft, 140, $inputwidth, $inputheight) While 1 _check() Sleep(10) WEnd Func _check() If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") endif EndFunc Edited March 24, 2008 by monoceres Broken link? PM me and I'll send you the file!
Swift Posted March 24, 2008 Posted March 24, 2008 (edited) You must loop the _check function: $Input = GUICtrlCreateInput ("@+" , $inputleft, 140, $inputwidth, $inputheight) While 1 _check() Sleep(10) WEnd Func _check() If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") endif EndFuncoÝ÷ Ûú®¢×«lø^Á©í²Úç$~âµëÞ¯)^²Ëajv¬yÊ'tw©®Ún¡jƺÛhÚç$~â´áz¬i»¶î±ëaÆ®¶sbb33c´çWBÒuT7G&Ä7&VFTçWBgV÷C´²gV÷C²Âb33c¶çWFÆVgBÂCÂb33c¶çWGvGFÂb33c¶çWFVvB¢Æö÷W&R¤66Rb33c´'WGFöà¤bô6V6²ÒFVà¤×6t&÷ÂgV÷C²gV÷C²ÂgV÷Cµ÷R6ææ÷BW6RçöbFW6R6&7FW'3¢ò²ÒâÂôgV÷C²¤VÇ6P£´Fò6öÖWFærVÇ6RW&RââçFR&W7Böb÷W"6öFRââæÆ¶RgVæ7Föââà ¤gVæ2ö6V6²¤b7G&æu&VtWwV7G&Å&VBb33c´çWBÂgV÷Cµ²òÒ²ÓÒÒâÒÂÒòÔÒgV÷C²FVâ&WGW&â¤VæDgVæ0 Edited March 24, 2008 by R6V2
autoitxp Posted March 24, 2008 Author Posted March 24, 2008 I Tryed all examples but non of them works properly like : Why ? $Input = GUICtrlCreateInput ("+2+!+@+1" , $inputleft, 140, $inputwidth, $inputheight) $btn = GUICtrlCreateButton ("Test", 150, 400, 80) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $btn call ("_check") EndSelect Wend Func _check() If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") Return endif EndFunc
Developers Jos Posted March 24, 2008 Developers Posted March 24, 2008 I Tryed all examples but non of them works properly like : Why ?You did add some more code to these examples like a GuiCreate() statement ... right ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Swift Posted March 24, 2008 Posted March 24, 2008 You did add some more code to these examples like a GuiCreate() statement ... right ? Im sure he did, because he has undeclared variables, so, maybe, but it should work right...
autoitxp Posted March 24, 2008 Author Posted March 24, 2008 ya i did all gui creat variable declared when i hit button nothing happes ?
Developers Jos Posted March 24, 2008 Developers Posted March 24, 2008 ya i did all gui creat variable declared when i hit button nothing happes ? Then show all code so we can see what you are doing. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
autoitxp Posted March 24, 2008 Author Posted March 24, 2008 expandcollapse popup#include <GUIConstants.au3> GUICreate("My Gui", 800, 600 , -1 , -1 ) local $Input $lablewidth = 70 $lableleft = 120 $inputleft = 240 $inputwidth = 180 $inputheight= 20 $font="Arial" GUISetFont (10, 400, $font) GUICtrlCreateTab (80, 80, 400,400) $tab_1 =GUICtrlCreateTabitem ("Records") GUISetFont (9, 400, $font) GUICtrlCreateLabel ("ID:", $lableleft, 140 , $lablewidth) GUICtrlCreateLabel ("Date:", $lableleft , 170) GUICtrlCreateLabel ("Company:", $lableleft, 200) GUICtrlCreateLabel ("Description:", $lableleft , 230) GUICtrlCreateLabel ("Voucher:", $lableleft, 260) GUICtrlCreateLabel ("Posted By:", $lableleft , 290) GUICtrlCreateLabel ("Autherized By:", $lableleft, 320) GUICtrlCreateLabel ("Amount:", $lableleft , 350) $Input = GUICtrlCreateInput ("+2+!+@+1" , $inputleft, 140, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 170, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 200, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 230, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 260, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 290, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 320, $inputwidth, $inputheight) GUICtrlCreateInput ("", $inputleft, 350, $inputwidth, $inputheight) $btn = GUICtrlCreateButton ("Test", 150, 400, 80) ;GUICtrlCreatePic ("bg_1.gif", 480, -300, 140 ,150) ;GUICtrlCreatePic ("bg.jpg", -1, -1, 140 ,150 ) GUICtrlCreateTabitem ("") GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $btn call ("_check") EndSelect Wend Func _check() ; MsgBox(0 , "" ,"test") If StringRegExp(GuiCtrlRead($Input),"[ _-+-=-.-,-/-@]") then MsgBox(0,"","You cannot use any of these characters: _ + = ., /@ ") Return endif EndFunc
Developers Jos Posted March 24, 2008 Developers Posted March 24, 2008 The regex is not working...try: While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $btn _check() EndSelect WEnd Func _check() ; MsgBox(0 , "" ,"test") If StringRegExp(GUICtrlRead($Input), "[ _\-\+=\.,/\@]",0) Then MsgBox(0, "", "You cannot use any of these characters: _ + = ., /@ ") Return EndIf EndFunc ;==>_check SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
autoitxp Posted March 24, 2008 Author Posted March 24, 2008 Thanks now its working we missing \ in StringRegExp
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