Page 1 of 1

BackSpace Key help

Posted: Mon May 25, 2009 9:57 pm
by bidgeeman
Hi.
Can anyone tell me how to put one "Backspace" into a Text fiield, or, delete the last character entered in a text field? I have tried:
put backspaceKey into fld "Text" but the entire Field is deleted. I cannot use the "delete char" function as the character number is always changing.

Thanks for any help.

Cheers
Bidge

EDIT: Ahh....I've managed to figure it out :)

delete last char of field "Text"

Re: BackSpace Key help

Posted: Fri Dec 18, 2015 10:54 am
by razvan
Need to put this code on the field

Code: Select all

on backspacekey
   if the selectedText is not empty
   then delete the selectedText
   else
      delete the last char of me
   end if
end backspacekey
but i have no ideea how to delete a current char now ..(example if you press 2x left button and after press backspace ..this function will delete the last char,no current char)
Greetings!
Razvan

Re: BackSpace Key help

Posted: Fri Dec 18, 2015 1:07 pm
by Klaus
Hi Razvan,

not sure I understand you, but this sounds like the solution to me:

Code: Select all

on backspacekey
   if the selectedText is not empty then 
       delete the selectedText
   else
      ## Let the OS do the right thing:
      PASS backspacekey
   end if
end backspacekey
Best

Klaus

Re: BackSpace Key help

Posted: Fri May 20, 2016 9:41 am
by razvan
Thanks Klaus,
Your code is working well.