BackSpace Key help

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

BackSpace Key help

Post by bidgeeman » Mon May 25, 2009 9:57 pm

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"

razvan
Posts: 19
Joined: Tue Feb 24, 2015 10:16 am

Re: BackSpace Key help

Post by razvan » Fri Dec 18, 2015 10:54 am

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

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: BackSpace Key help

Post by Klaus » Fri Dec 18, 2015 1:07 pm

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

razvan
Posts: 19
Joined: Tue Feb 24, 2015 10:16 am

Re: BackSpace Key help

Post by razvan » Fri May 20, 2016 9:41 am

Thanks Klaus,
Your code is working well.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”