[DUG] TCustomControl's keyboard input

Stacey Verner stacey at cjntech.co.nz
Tue Dec 12 13:34:54 NZDT 2006


There are things you have to do when setting up a control to allow it to
accept special keys.

You can handle the WM_GETDLGCODE message and return DLGC_WANTARROWS or
for more control handle the CM_WANTSPECIALKEY message.

Stacey

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Gajo Csaba
Sent: Tuesday, 12 December 2006 11:56
To: delphi at ns3.123.co.nz
Subject: [DUG] TCustomControl's keyboard input

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.


_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi



More information about the Delphi mailing list