如何重载TAB 处理事件! ( 积分: 100 )

  • 主题发起人 主题发起人 shangxuan
  • 开始时间 开始时间
S

shangxuan

Unregistered / Unconfirmed
GUEST, unregistred user!
TAB 默任处理的事件是焦点的却换,而我需要处理自己的事件,如何解决.谢谢!<br><br>希望提供代码!
 
TAB 默任处理的事件是焦点的却换,而我需要处理自己的事件,如何解决.谢谢!<br><br>希望提供代码!
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=115578<br><br>把下列代码放到onkeypress中,注意,如果是form, keyPreview:=true<br><br>var<br> &nbsp; MYForm: TCustomForm;<br>begin<br> &nbsp; if Key = #13 then<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; MYForm := GetParentForm( Self );<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if not (MYForm = nil ) then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendMessage(MYForm.Handle, WM_NEXTDLGCTL, 0, 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Key := #0;<br><br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp;if Key &lt;&gt; #0 then inherited KeyPress(Key);<br>end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部