Board index » delphi » Filtering keypresses - how do I 'throw' a keypress away??

Filtering keypresses - how do I 'throw' a keypress away??

What I'm trying to do is stop letters from being entered into a TEdit
object. I'm able to pickup the keyspressed and then alter them, but I
can't 'throw' them away if I don't want them. How do I get rid of a
keypress?

Note that the MaskEdit object used for dates etc has little underscores
when there is no data. I don't want them - that's why I'm not using this
object. If you know how to fix my problem here, please tell me!

Thanks, Andrew, and all who read this -> Have a _very_ merry Christmas!

--------------------------------------
WWW: http://www.softconn.co.za/~shadow
--------------------------------------

 

Re:Filtering keypresses - how do I 'throw' a keypress away??


Quote
Shadow <sha...@quark.softconn.co.za> wrote:
>What I'm trying to do is stop letters from being entered into a TEdit
>object. I'm able to pickup the keyspressed and then alter them, but I
>can't 'throw' them away if I don't want them. How do I get rid of a
>keypress?
>Note that the MaskEdit object used for dates etc has little underscores
>when there is no data. I don't want them - that's why I'm not using this
>object. If you know how to fix my problem here, please tell me!
>Thanks, Andrew, and all who read this -> Have a _very_ merry Christmas!
>--------------------------------------
>WWW: http://www.softconn.co.za/~shadow
>--------------------------------------

if not (key in ['0'..'9'] ) then
key := #0;

Merry, Christmas!

Re:Filtering keypresses - how do I 'throw' a keypress away??


Set the keycode = #0

In article <30D8F813.7...@quark.softconn.co.za>, sha...@quark.softconn.co.za
says...

Quote

>What I'm trying to do is stop letters from being entered into a TEdit
>object. I'm able to pickup the keyspressed and then alter them, but I
>can't 'throw' them away if I don't want them. How do I get rid of a
>keypress?

>Note that the MaskEdit object used for dates etc has little underscores
>when there is no data. I don't want them - that's why I'm not using this
>object. If you know how to fix my problem here, please tell me!

>Thanks, Andrew, and all who read this -> Have a _very_ merry Christmas!

>--------------------------------------
>WWW: http://www.softconn.co.za/~shadow
>--------------------------------------

--
___________________________________________________________________________
Kirk Wolak
KWo...@mail.cbf.com
//
// Const ViewsExpressed = "My own and not those of the company I work for!";
//

Re:Filtering keypresses - how do I 'throw' a keypress away??


s>Thanks, Andrew, and all who read this -> Have a _very_ merry Christmas!

I agree with your wish to wish good wishes, _but_  a good percentage of
people on the Net are not interested in celebrating Christmas :-)

---
 t SRP 2.00 #1203 t I can't stand intolerant people.

Re:Filtering keypresses - how do I 'throw' a keypress away??


In article <30D8F813.7...@quark.softconn.co.za>
   Shadow <sha...@quark.softconn.co.za> writes:
Quote
>What I'm trying to do is stop letters from being entered into a TEdit
>object. I'm able to pickup the keyspressed and then alter them, but I
>can't 'throw' them away if I don't want them. How do I get rid of a
>keypress?

This suggests you are trying to enter numeric information. If so, get the
numedit component from the Delphi super page. It's free, works well, and the
author responded immediately when I mailed him with a query. It also gives
you some extra goodies, like choice of display formats.

Pat

Other Threads