Sign in to follow this  
Followers 0
autoitxp

GUICtrlCreateInput

14 posts in this topic

#1 ·  Posted (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 by autoitxp

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by autoitxp

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by R6V2

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

ya i did all gui creat variable declared when i hit button nothing happes ? :)

Share this post


Link to post
Share on other sites

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.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks now its working we missing

\

in StringRegExp

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