[DUG] TCustomControl's keyboard input

Gajo Csaba csaba at enyem.com
Tue Dec 12 11:56:10 NZDT 2006


Hello,

I'm writing a custom memo control to display some special symbols. All is  
going well and I'm already able to type in any character, as well as  
delete with backspace and del. The only problem that remains are the left  
and right buttons which should be used for moving the cursor.
What happens is that when I press either left or right the component loses  
focus. Since this component is the only one on the form, it doesn't have  
anything to lose the focus to, but this does happen, since the OnEnter and  
OnExit events get executed. When I press left 2 more times the focus  
returns.
I've made an OnKeyDown method which should handle the left and right keys.  
I've checked with the debugger and it never enters this method! When I  
press Enter, for example, then it does enter the method, so it only  
doesn't seem to work with left and right.

Any idea how I should handle this?

Thanks, Csaba

p.s. I'm using Delphi 5.




More information about the Delphi mailing list