[Closed] edittext: backspace problem
Hi,
I have this problem with my code.
on __fileBase changed arg do (
cutValue = arg.count
if (matchPattern arg pattern:"*_*" == true) do (
arr = filterString arg "_"
arg = ""
for itm in arr do arg += itm
)
__fileBase.text = arg
A = substring __fileName.text 1 offsetFileName
print A
B = substring __fileName.text (offsetFileName + cutValue) 999
print B
print cutValue
__fileName.text = A + arg + B
)
So the way it works is that each key entered it’s evaluating the code. It is reading itself and than splitting into A (string before) + arg(string entered) + B(string after).
So now when I press backspace it is reading itself but does not cut the string properly. Thats why it fails.
Is there any way I can make a statement that the pressed key is backspace? does mxs can compare keyboard keys?
it would be better to use “entered” event instead of “changed”.
btw
substring __fileName.text (offsetFileName + cutValue) 999
substring length specified as -1 means “to the end of the string”
Thanks, didnt know that.
As for “entered” event instead of “changed”. Yeah this would work, but I really want to use changed. It just looks cooler But if I don’t find any other fix I will change it to “entered”