Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2004
    Posts
    113

    FilterKeyPress ?

    I had an apms 6 project and part of the code was to filter characters in an input box:

    FilterKeyPress(this, e_Key, "1234567890.")

    While in apms 6 this worked fine and I could input lots of characters - in amps 7 is doesn't work as it only allows me to put one character in the input box at a time, what's changed in apms 7 that causes this? and is there a workaround?

  2. #2
    Join Date
    Jun 2004
    Posts
    113
    Doh! found the answer using google - which brought me back to a post on here, funny though as the search on the forum didn't show it up.

    Sorted anyway though!

  3. #3
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Please are thy willing to share this discovery with us? xD
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  4. #4
    Join Date
    Jun 2004
    Posts
    113
    In the input box onkey event:

    Code:
    FilterKeyPress(this, e_Key, "1234567890.")
    In the global functions
    Code:
    function FilterKeyPress(InputObject, e_Key, sAllowed)
    	sOrig = Input.GetText(InputObject)
    	sFilter = String.TrimLeft(sOrig, sAllowed)
    	sFilteredLeft = String.TrimLeft(sOrig, sFilter)
    	sFilteredRight = String.TrimRight(sFilteredLeft, sFilter)
    	Input.SetText(InputObject, sFilteredRight)
    	
    	Input.SetSelection(InputObject, String.Length(Input.GetText(InputObject)) + 1, String.Length(Input.GetText(InputObject)))
    	Input.SetSelection(InputObject, -1, 1)
    end
    That's all - I think.

  5. #5
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Thanks for sharing
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  6. #6
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959

  7. #7
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Ah thanks, i'm trying to understand string.gfind to try to regex some strings... I managed to do some basic things, but the real regexing is still to dam hard.

    Gotta keep trying though ^^
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  8. #8
    Join Date
    Mar 2007
    Posts
    452
    when i use filter keypress;
    how can i allow tab key ?

    Code:
    FilterKeyPress(this, e_Key, "1234567890.")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts