Thanks to our friends in the forum .. I have been able to sub-class xBrowse ( 1203 ) to allow some additional navigation keys, but in doing so, I can now longer trap other keys like INS and DEL.
As you can see from the sub-class .. I have rem'd out the Return Super:KeyDown( nKey, nFlags ) because I have no Idea how to pass SUPER to the RkeyDown Method.
Any help here would be appreciated!
Rick Lipkin
Main.prg
- Code: Select all Expand view
OVERRIDE METHOD KeyDown IN CLASS TXBrowse WITH RKeyDown
EXTEND CLASS TDIALOG WITH DATA nKey
RkeyDown
- Code: Select all Expand view
//----------------------------------
FUNCTION RKeyDown( nKey,nFlags )
LOCAL Self := HB_QSelf()
local oCol
nFlags := 983041
::oWnd:nKey := nKey
do case
case nKey == VK_ESCAPE
if ::lEditMode
oCol := ::SelectedCol()
if oCol:oEditLbx != nil
oCol:oEditLbx:nLastKey = VK_ESCAPE
endif
if oCol:oEditGet != nil
oCol:oEditGet:nLastKey := VK_ESCAPE
endif
::CancelEdit()
return 0
else
* return Super:KeyDown( nKey, nFlags )
* return TDialog():KeyDown( nKey, nFlags )
endif
case nKey == VK_LEFT .and. GetKeyState( VK_SHIFT ) .or. ;
nKey == VK_RIGHT .and. GetKeyState( VK_SHIFT )
nKey == VK_INSERT
return Super:KeyDown( nKey, nFlags )
case nKey == VK_UP .and. GetKeyState( VK_SHIFT )
::Select( 5 )
::GoUp()
::Select( 5 )
case nKey == VK_DOWN .and. GetKeyState( VK_SHIFT )
::Select( 5 )
::GoDown()
::Select( 5 )
case nKey == VK_UP
::Select( 0 )
::GoUp()
::Select( 1 )
case nKey == VK_DOWN
::Select( 0 )
::GoDown()
::Select( 1 )
case nKey == VK_LEFT
if GetKeyState( VK_CONTROL )
::GoLeftMost()
else
::GoLeft()
endif
case nKey == VK_RIGHT
if GetKeyState( VK_CONTROL )
::GoRightMost()
else
::GoRight()
endif
case nKey == VK_TAB // added rick lipkin
if GetKeyState( VK_CONTROL )
::GoRightMost()
else
::GoRight()
endif
case nKey == VK_HOME
::Select( 0 )
::GoTop()
::Select( 1 )
case nKey == VK_END
::Select( 0 )
::GoBottom()
::Select( 1 )
case nKey == VK_PRIOR
::Select( 0 )
if GetKeyState( VK_CONTROL )
::GoTop()
else
::PageUp()
endif
::Select( 1 )
case nKey == VK_NEXT
::Select( 0 )
if GetKeyState( VK_CONTROL )
::GoBottom()
else
::PageDown()
endif
::Select( 1 )
case nKey == VK_ADD .and. GetKeyState( VK_CONTROL )
::FontSize( +1 )
::Refresh()
case nKey == VK_SUBTRACT .and. GetKeyState( VK_CONTROL )
::FontSize( -1 )
::Refresh()
case ::lAllowCopy .and. nKey == ASC( 'C' ) .and. GetKeyState( VK_CONTROL )
::Copy()
case nKey == VK_F2 .and. ::lF2KeyToEdit
if ! ::lEditMode
::SelectedCol():Edit()
endif
otherwise
* return Super:KeyDown( nKey, nFlags )
return TDialog():KeyDown( nKey, nFlags )
endcase
return 0