为何对在TDBCrtlGrid上的TDBEdit按回车键不能响应KeyPress过程(50分)

  • 主题发起人 主题发起人 Yong
  • 开始时间 开始时间
Y

Yong

Unregistered / Unconfirmed
GUEST, unregistred user!
为何对在TDBCrtlGrid上的TDBEdit按回车键不能响应KeyPress过程,除了回车键别的键都能响应
 
Use" KeyDown" instead of "KeyPress."
 
Use the OnKeyDown event handler to specify special processing to
occur when a key is pressed. The OnKeyDown handler can respond to all
keyboard keys, including function keys and keys combined with the Shift, Alt, and Ctrl keys, and pressed mouse buttons.
Keys thatdo
n't correspond to an ASCII Char value (Shift or F1,
for example)do
n't generate an OnKeyPress event.
 
why?
simply set form's keypreview to true
then
put all key processing code into form.keypress
sender is the identifier
for example:
form1.onkeypreview
begin
if sender is DBEdit1 then
begin
showmessage('sender is dbedit1');
end;
end;
 
CJ:
Your Method is not good enough! :-{
When Use form's OnkeyPress,Whenever u proess a key ,it will
Trigger the Event,regardless if it is neccessary!
 
The question is when TDbEdit is at the TDBCtrlGrid,you press "Enter",It can not Trigger KeyPress or KeyDown or KeyUp.Only at the
TDBCtrlGrid and only "Enter"
 
时间太久,强制结束。 wjiachun
 
后退
顶部