View Full Version : FilterKeyPress ?
mrdude
02-15-2009, 07:01 PM
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?
mrdude
02-15-2009, 07:12 PM
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!
Imagine Programming
02-15-2009, 07:15 PM
Please are thy willing to share this discovery with us? xD :D
mrdude
02-15-2009, 07:52 PM
In the input box onkey event:
FilterKeyPress(this, e_Key, "1234567890.")
In the global functions
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.
Imagine Programming
02-16-2009, 04:50 AM
Thanks for sharing:)
http://www.indigorose.com/forums/showthread.php?t=17451&highlight=filter+key
Imagine Programming
02-16-2009, 06:45 AM
http://www.indigorose.com/forums/showthread.php?t=17451&highlight=filter+key
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 ^^
GoOgLe
03-11-2009, 04:35 AM
when i use filter keypress;
how can i allow tab key ?
FilterKeyPress(this, e_Key, "1234567890.")
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.