How to detect modifier key change in a control which doesn't have focus?

后端 未结 4 1513
故里飘歌
故里飘歌 2020-12-31 07:18

Background:

I\'m working on a control derived from TCustomControl class which can get focus and which has some inner elements inside. Those inner elem

4条回答
  •  不知归路
    2020-12-31 07:46

    I would write a message handler for WM_SETCURSOR message to call GetKeyboardState to get the keyboard state (in Delphi you can just call KeyboardStateToShiftState) and based on the result of that (and the hit test) call SetCursor with the appropriate cursor.

    For handling WM_SETCURSOR, there's an example in the VCL: TCustomGrid.WMSetCursor in the Grids unit.

提交回复
热议问题