?
Solved

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

Posted on 2005-03-01
6
Medium Priority
?
1,373 Views
Last Modified: 2012-08-14
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
Comment
Question by:wildzero
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 13436172
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
 
LVL 10

Author Comment

by:wildzero
ID: 13436185
True :-)
This presents
Undecleared identifier : 'vk_Backspace'
Herm...

;)
0
 
LVL 5

Expert Comment

by:J-A-L
ID: 13436245
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Author Comment

by:wildzero
ID: 13436253
Yes I know which does which, im after backspace
'.... but I can't use backspace to delete.... .'
0
 
LVL 5

Accepted Solution

by:
J-A-L earned 500 total points
ID: 13436276
Yup... I believe it's called "vk_back"

Jeff
0
 
LVL 10

Author Comment

by:wildzero
ID: 13436281
Bingo :D
Thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question