From 60d3f03007e5d741ae7c5950043f017d1f5389bd Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Sun, 1 Aug 1999 11:50:03 +0000 Subject: [PATCH] K_HOME and H_END implemented on popups --- harbour/tests/working/debugger.prg | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/harbour/tests/working/debugger.prg b/harbour/tests/working/debugger.prg index 00a8b38486..9cdc1a4820 100644 --- a/harbour/tests/working/debugger.prg +++ b/harbour/tests/working/debugger.prg @@ -80,12 +80,15 @@ CLASS TDbMenu /* debugger menu */ METHOD Build() METHOD ClosePopup() METHOD Close() INLINE ::ClosePopup( ::nOpenPopup ), ::nOpenPopup := 0 + METHOD DeHilite() METHOD Display() METHOD EvalAction() METHOD GetHotKeyPos( nKey ) + METHOD GoBottom() METHOD GoDown() INLINE ::aItems[ ::nOpenPopup ]:bAction:GoRight() METHOD GoLeft() METHOD GoRight() + METHOD GoTop() METHOD GoUp() INLINE ::aItems[ ::nOpenPopup ]:bAction:GoLeft() METHOD IsOpen() INLINE ::nOpenPopup != 0 METHOD ProcessKey( nKey ) @@ -192,6 +195,14 @@ METHOD ClosePopup( nPopup ) CLASS TDbMenu return nil +METHOD DeHilite() CLASS TDbMenu + + local oMenuItem := ::aItems[ ::nOpenPopup ] + + oMenuItem:Display( ::cClrPopup, ::cClrHotKey ) + +return nil + METHOD Display() CLASS TDbMenu local n, nAt @@ -252,6 +263,18 @@ return 0 return .f. +METHOD GoBottom() CLASS TDbMenu + + local oPopup + + if ::IsOpen() + oPopup = ::aItems[ ::nOpenPopup ]:bAction + oPopup:DeHilite() + oPopup:ShowPopup( Len( oPopup:aItems ) ) + endif + +return nil + METHOD GoLeft() CLASS TDbMenu local oMenuItem := ::aItems[ ::nOpenPopup ] @@ -313,6 +336,18 @@ METHOD GoRight() CLASS TDbMenu return nil +METHOD GoTop() CLASS TDbMenu + + local oPopup + + if ::IsOpen() + oPopup = ::aItems[ ::nOpenPopup ]:bAction + oPopup:DeHilite() + oPopup:ShowPopup( 1 ) + endif + +return nil + METHOD ShowPopup( nPopup ) CLASS TDbMenu local nAt, oPopup, oMenuItem @@ -365,6 +400,12 @@ METHOD ProcessKey( nKey ) CLASS TDbMenu case nKey == K_ENTER ::EvalAction() + case nKey == K_HOME + ::GoTop() + + case nKey == K_END + ::GoBottom() + otherwise if ( nPopup := ::GetHotKeyPos( AltToKey( nKey ) ) ) != 0 ::Close() @@ -381,6 +422,7 @@ CLASS TDbMenuItem DATA bAction METHOD New( cPrompt, bAction ) + METHOD Display( cClrText, cClrHotKey ) ENDCLASS @@ -391,6 +433,17 @@ METHOD New( cPrompt, bAction ) CLASS TDbMenuItem return Self +METHOD Display( cClrText, cClrHotKey ) CLASS TDbMenuItem + + @ ::nRow, ::nCol SAY ; + StrTran( ::cPrompt, "&", "" ) COLOR cClrText + + @ ::nRow, ::nCol + nAt := ; + At( "&", ::cPrompt ) - 1 SAY ; + SubStr( ::cPrompt, nAt + 2, 1 ) COLOR cClrHotKey + +return nil + static function AltToKey( nKey ) local nIndex := AScan( { K_ALT_A, K_ALT_B, K_ALT_C, K_ALT_D, K_ALT_E, K_ALT_F,;