[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1382
  • Last Modified:

TEdit to only accept alpha chars and delete....

Hello there,

I have a TEdit and on Keypress event I have

if not (Key in ['A'..'z']) or (Key = 'vk_Delete') or (Key = 'vk_Clear') or (key = 'vk_Backspace') then
  Key := #0;

But for some reason the backspace doesn't work, I can type in, but I can't use backspace to delete....
Herm..
0
wildzero
Asked:
wildzero
  • 3
  • 2
1 Solution
 
TheRealLokiSenior DeveloperCommented:
you should not have ' ' around the constants
if key is a char do this

if not (Key in ['A'..'z', chr(vk_Delete), chr(vk_Clear), chr(vk_Backspace)] then key := #0;
0
 
wildzeroAuthor Commented:
True :-)
This presents
Undecleared identifier : 'vk_Backspace'
Herm...

;)
0
 
J-A-LCommented:
That's right... backspace is different than Delete.  Delete erases the character to the right... backspace erases the character to the left of the cursor.

Jeff
at yourtechonline.com
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
wildzeroAuthor Commented:
Yes I know which does which, im after backspace
'.... but I can't use backspace to delete.... .'
0
 
J-A-LCommented:
Yup... I believe it's called "vk_back"

Jeff
0
 
wildzeroAuthor Commented:
Bingo :D
Thank you
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now