More keyboard trapping questions ...
Publicado: Mar Sep 20, 2016 12:52 pm
Hi,
My ScreenPrompt class inherited from TLabelEx and my PromptBar class inherited from TBevel are working well and have mouse & keyboard 'action key' character support.
I now have adapted by PromptBar class to display its ScreenPrompt objects in a vertical menu format. Again this works well for mouse & keyboard 'action key' character support.
But I need to use the UP and DOWN cursor keys to also move the prompt hilite, but I cannot trap those keys with either the OnKeydown or WMKeyDown events.
The TBevel class I am using inherits from TWinControl which has its own WMKeyDown that traps the cursor keys for moving around its controls.
Question 1 is : Why does my redefined WMKeyDown method not override the TBevel or TStdControl own WMKeydown method particularly as I do NOT call ::Super:WMKeyDown() ... see below
METHOD WMKeyDown( nKey, nFlags, hWnd ) CLASS TBsPromptBar
LogDisplay( "TBsPromptBar:WMkeyDown()", nKey, Chr( nKey) )
// ::Super:WMKeydown( nKey, nFlags, hWnd )
RETURN nil
PromptBar inherited from TWinControl or TBevel below
If I inherit by ScreenPromptBar class from TStdControl I do seem able to add a WMKeyDown() method which does receive the cursor keys .... but I seem to lose some other useful colour properties? below
Question 2 is : I dont really understand when you should use the OnKeyDown event or WMKeyDown Method.
Any help would be appreciated.
I have attached my test project source .... it is a bit of a hack, just trying to get something to work!
My ScreenPrompt class inherited from TLabelEx and my PromptBar class inherited from TBevel are working well and have mouse & keyboard 'action key' character support.
I now have adapted by PromptBar class to display its ScreenPrompt objects in a vertical menu format. Again this works well for mouse & keyboard 'action key' character support.
But I need to use the UP and DOWN cursor keys to also move the prompt hilite, but I cannot trap those keys with either the OnKeydown or WMKeyDown events.
The TBevel class I am using inherits from TWinControl which has its own WMKeyDown that traps the cursor keys for moving around its controls.
Question 1 is : Why does my redefined WMKeyDown method not override the TBevel or TStdControl own WMKeydown method particularly as I do NOT call ::Super:WMKeyDown() ... see below
METHOD WMKeyDown( nKey, nFlags, hWnd ) CLASS TBsPromptBar
LogDisplay( "TBsPromptBar:WMkeyDown()", nKey, Chr( nKey) )
// ::Super:WMKeydown( nKey, nFlags, hWnd )
RETURN nil
PromptBar inherited from TWinControl or TBevel below
If I inherit by ScreenPromptBar class from TStdControl I do seem able to add a WMKeyDown() method which does receive the cursor keys .... but I seem to lose some other useful colour properties? below
Question 2 is : I dont really understand when you should use the OnKeyDown event or WMKeyDown Method.
Any help would be appreciated.
I have attached my test project source .... it is a bit of a hack, just trying to get something to work!