[lazarus] TEdit control lacks a OnKeyPress event

Andrew Johnson aj_genius at hotmail.com
Mon Sep 23 20:31:50 EDT 2002


>Shouldn't the TEdit control include an OnKeyPress event?
Yep it should...

>I was looking at the source for the TComboBox and can't figure out how
>it's implemented... I don't see any actual code for it, just the
>property definition.
That's because its a re-declaration of a property defined in one of its 
ancestors.

If a Property is declared as just the Property and the name it usually menas 
that you are making public or published a property which was Protected in it 
parent(s). AKA it has already been implemented elsewhere.

>Is it a GTK problem?

nope.. Don't why it isn't there.. or Key Down/Up either.. To make OnKeyPress 
a Published Property all you should have to do is add Property OnKeyPress; 
to the TEdit Published Section, and recompile the LCL and Lazarus.

However there does seem to be a GTK problem wherein changing the Key value 
doesn't do anything, so if you were planning on making a Date Mask, or 
filtering out non-numeric chars for a Money field, it won't work yet. I am 
going to see how easy it is to fix. But until Mattias gets back from 
Vacation it can't be committed to CVS. What you might consider doing if this 
is the case though, is deleting the last char in the edit text if its not 
one you want to allow. Obviously this is only a Temp. Hack but it might work 
nonetheless.

Andrew



TTFN
Genius(in name only)


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com






More information about the Lazarus mailing list