TEdit OnKeyPress event! 
Author Message
 TEdit OnKeyPress event!

Hi!

I'm using a edit field as a search key in a table. I'm serching the table
while I'm typing in the edit field. I made this search thru the OnKeyPress
event and it's working but when I check the edit.text property in the
OnKeyPress event I always get a string that is one character shorter then
what is shown on the screen.

                    Please help!



Fri, 06 Apr 2001 03:00:00 GMT  
 TEdit OnKeyPress event!

Quote:

>Hi!

>I'm using a edit field as a search key in a table. I'm serching the table
>while I'm typing in the edit field. I made this search thru the OnKeyPress
>event and it's working but when I check the edit.text property in the
>OnKeyPress event I always get a string that is one character shorter then
>what is shown on the screen.

WinControls generally process key messages *before* updating
themselves - this enables you to reject certain keystrokes (for
example you could write a TEdit that only accepts the letters a..k).
This is why you're getting what seems to be the "previous" string.

Move your code to the OnChange event of the TEdit - this code
get executed *after* the contents have been updated.

--
Jeremy Collins
Kansai Business Systems



Fri, 06 Apr 2001 03:00:00 GMT  
 TEdit OnKeyPress event!

Quote:

> Hi!

> I'm using a edit field as a search key in a table. I'm serching the table
> while I'm typing in the edit field. I made this search thru the OnKeyPress
> event and it's working but when I check the edit.text property in the
> OnKeyPress event I always get a string that is one character shorter then
> what is shown on the screen.

>                     Please help!

    Try to put your search code in OnChange event handler. I think it should
work. By he way do you know how to make some kind of event handler for
automation object (Word for example). I wont automation object to notify me when
user do some action.


Fri, 20 Apr 2001 03:00:00 GMT  
 TEdit OnKeyPress event!

Quote:

> Hi!

> when I check the edit.text property in the
> OnKeyPress event I always get a string that is one character shorter then
> what is shown on the screen.

>                     Please help!

The OnKeyPress event is generated when the key is pressed down, but the key
which is pressed down does not get added to the edit.text until the key is
released.

Alan Lloyd



Fri, 20 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Pressing Enter doesn't trigger OnKeyPress event

2. Delphi event handlers and TEdit controls

3. Onkeypress

4. Call an event within another event

5. Converting string name to TEdit

6. SQL Retrieving data from a TEdit

7. Selections in a TEdit (TPW)

8. How to convert TEdit->Text to date?

9. Activating TEdit

10. TEdit Handle (please help)

11. TFileWindow (descendant of TEdit in TPW 1.5)

12. TEdit.GetLine [Windows]

 

 
Powered by phpBB® Forum Software