Delphi XE and Trapping Arrow Key with OnKeyDown

后端 未结 5 1565
闹比i
闹比i 2020-12-06 17:21

I want my form to handle the arrow keys, and I can do it -- as long as there is no button on the form. Why is this?

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 18:02

    Because they are preempted to deal with setting the focus on the next available WinControl.
    (I'm pretty sure that if you put an Edit instead of a Button you see the same thing).

    If you want to handle them yourself, you can provide the Application with an OnMessage event that will filter those before they are processed and handle them yourself there.

提交回复
热议问题