Alaska Software Inc. - LASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
Username: Password:
AuthorTopic: LASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
AUGE_OHRLASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
on Wed, 16 Feb 2005 17:49:42 +0100
hi,

i wanted the source be compatible with Cl*pper so i use #IFDEF __XPP__

now i got a older Cl*pper Application with a lot of DBEDIT.
each of them have a different UserUDF

if i SetMouse(.T.) and use Xbase++ DBEDIT(), BROWSE() and use F2 -
Fxx, how can i enhance it :

#IFDEF __XPP__
   IF SETMOUSE()
      nTaste := LastAppEvent( @mp1 )
   ELSE
      nTaste := LASTKEY()
   ENDIF
#ELSE
   nTaste := LASTKEY()
#ENDIF
...
DO CASE
   CASE db_mode == 0
   CASE db_mode == 1
   CASE db_mode == 2
   CASE db_mode == 3
   CASE db_mode < 4
   CASE nTaste == K_ESC   == xbeK_ESC == 27
   CASE nTaste == K_F10    ???

while K_F10 == -9  and xbeK_F1  ==  65648 ?

CASE nTaste == K_F10 .or. nTaste == xbeK_F1
is not a option, while a have only little room at Cl*pper DGROUP
for more #define

greetings by OHR
Jimmy
Mark CarewRe: LASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
on Fri, 25 Feb 2005 08:10:05 +1000
Hi Jimmy,

    What is db_mode ? Have a look at TBhandleEvent() to see how to 
incorporate and event loop in tbrowse() in xbase.
    If You rely on inkey() return values, you will have to translate the 
event return codes from xbeK_??? to K_???
    I have snipped some code that is a work in progress for you. It uses 
tbrowse and event loop.
    Maybe ther is another way of translating event codes to inkeys, but I 
couldn't find it in the doco?

HTH
    Regards
        Mark

--------------   snip -----------------------
      start of browser keyboard interaction
      start of browser keyboard interaction
      start of browser keyboard interaction
      start of browser keyboard interaction
    *
    DO WHILE TRUE                                 level 2
      
        make sure the browse is stable
        and has a real event for processing
      
      DO WHILE !oBrowser:stabilize()
        *
        nEvent                  := AppEvent( @mp1, @mp2, @oXbp, .01 )
        *
        IF nEvent               > xbe_None .AND. ;
            nEvent              <> xbeM_Motion
          
          EXIT
          
        ENDIF
        
      ENDDO
      
        may already be stable
        get rid of mouse movements
      *
      IF oBrowser:stable
        
         TBrowse is stable
        
         filter out event
        
         "mouse is moved"
        *
        DO WHILE nEvent         == xbeM_Motion
          *
          nEvent                := AppEvent( @mp1, @mp2, @oXbp, 0 )
          
        ENDDO
        
      ENDIF
      *
      IF oBrowser:stable
        
         TBrowse is stable
        
         filter out event
        
         why this next statement is ABSOLUTELY necessary is beyond me 
????????????????
        *
        nEvent                  := xbeM_Motion
        
         "mouse is moved"
        *
        DO WHILE nEvent         == xbeM_Motion
          *
          nEvent                := AppEvent( @mp1, @mp2, @oXbp, 0 )
          
        ENDDO
        
      ENDIF
      
       Process Movement Event
      *
      nDirection                := ;
        TBHandleEvent( oBrowser, nEvent, mp1, mp2, oXbp )
      
       Not Movement
      *
      do case
      case nDirection           < 1 .AND. mp1 <> nil
        
          Ascii keys go straight through
        *
        if (mp1 >= 32 .and. mp1 <= 254 ) .or. ;
            mp1 == K_BS                  .OR. ;
            mp1 == K_ENTER
          *
          nKey                  := mp1
          
        else
          
          nKey                  := eventToInkey(mp1)
          
        ENDIF
        
        IF (nKey                > K_SH_TAB .AND. ;
            nKey                < K_ALT_EQUALS) .OR. ;
            nKey                == K_ENTER
          
            say you have some function keys and code blocks in an array
          *
          nAction                     := ;
            Ascan(aFunc, {|elem| nKey == elem[KEY]})
          
            special / specific to my app (non generic) case
            below
          
          IF nAction            > 0
            *
            uFunc               := ;
              aFunc[nAction, ACTION]
            *
            IF valType(uFunc)   == "A"
              *
              nKey              :=  K_TAB
              *
              xResult           := uFunc[1]
              
            ENDIF
            
          ENDIF
          
        ENDIF
        
      otherwise
        *
        nKey                    := 0
        *
        do case
        case nDirection == 2 .OR. nDirection == 8 .OR. nDirection == 5
        otherwise
          *
          nKey                  := eventToInkey(mp1)
          
        end case
        
      end case

---------------------------------------------
*
#include "appevent.ch"
#include "inkey.ch"
*
function eventToInkey(nEvent)
  
  local nScan
  local aLookup
  local nInKey
  
  aLookup := ;
    {;
    {K_HOME,          xbeK_HOME},;
    {K_CTRL_RIGHT,    xbeK_CTRL_RIGHT},;
    {K_PGDN,          xbeK_PGDN},;
    {K_RIGHT,         xbeK_RIGHT},;
    {K_UP,            xbeK_UP},;
    {K_END,           xbeK_END},;
    {K_DEL,           xbeK_DEL},;
    {K_BS,            xbeK_BS},;
    {K_CTRL_I,        xbeK_CTRL_I},;
    {K_F2,            xbeK_F2},;
    {K_F3,            xbeK_F3},;
    {K_F4,            xbeK_F4},;
    {K_F5,            xbeK_F5},;
    {K_F6,            xbeK_F6},;
    {K_F7,            xbeK_F7},;
    {K_F8,            xbeK_F8},;
    {K_F9,            xbeK_F9},;
    {K_F10,           xbeK_F10},;
    {K_CTRL_ENTER,    xbeK_CTRL_ENTER},;
    {K_CTRL_K,        xbeK_CTRL_K},;
    {K_CTRL_L,        xbeK_CTRL_L},;
    {K_ENTER,         xbeK_ENTER},;
    {K_CTRL_N,        xbeK_CTRL_N},;
    {K_CTRL_O,        xbeK_CTRL_O},;
    {K_CTRL_P,        xbeK_CTRL_P},;
    {K_CTRL_Q,        xbeK_CTRL_Q},;
    {K_PGUP,          xbeK_PGUP},;
    {K_LEFT,          xbeK_LEFT},;
    {K_CTRL_T,        xbeK_CTRL_T},;
    {K_CTRL_U,        xbeK_CTRL_U},;
    {K_INS,           xbeK_INS},;
    {K_CTRL_END,      xbeK_CTRL_END},;
    {K_DOWN,          xbeK_DOWN},;
    {K_CTRL_Y,        xbeK_CTRL_Y},;
    {K_CTRL_LEFT,     xbeK_CTRL_LEFT},;
    {K_ESC,           xbeK_ESC},;
    {K_F1,            xbeK_F1},;
    {K_CTRL_HOME,     xbeK_CTRL_HOME},;
    {K_CTRL_PGDN,     xbeK_CTRL_PGDN},;
    {K_CTRL_PGUP,     xbeK_CTRL_PGUP},;
    {K_SPACE,         xbeK_SPACE},;
    {K_SH_F1,         xbeK_SH_F1},;
    {K_SH_F2,         xbeK_SH_F2},;
    {K_SH_F3,         xbeK_SH_F3},;
    {K_SH_F4,         xbeK_SH_F4},;
    {K_SH_F5,         xbeK_SH_F5},;
    {K_SH_F6,         xbeK_SH_F6},;
    {K_SH_F7,         xbeK_SH_F7},;
    {K_SH_F8,         xbeK_SH_F8},;
    {K_SH_F9,         xbeK_SH_F9},;
    {K_SH_F10,        xbeK_SH_F10},;
    {K_CTRL_F1,       xbeK_CTRL_F1},;
    {K_CTRL_F2,       xbeK_CTRL_F2},;
    {K_CTRL_F3,       xbeK_CTRL_F3},;
    {K_CTRL_F4,       xbeK_CTRL_F4},;
    {K_CTRL_F5,       xbeK_CTRL_F5},;
    {K_CTRL_F6,       xbeK_CTRL_F6},;
    {K_CTRL_F7,       xbeK_CTRL_F7},;
    {K_CTRL_F8,       xbeK_CTRL_F8},;
    {K_CTRL_F9,       xbeK_CTRL_F9},;
    {K_CTRL_F10,      xbeK_CTRL_F10},;
    {K_ALT_F1,        xbeK_ALT_F1},;
    {K_ALT_F2,        xbeK_ALT_F2},;
    {K_ALT_F3,        xbeK_ALT_F3},;
    {K_ALT_F4,        xbeK_ALT_F4},;
    {K_ALT_F5,        xbeK_ALT_F5},;
    {K_ALT_F6,        xbeK_ALT_F6},;
    {K_ALT_F7,        xbeK_ALT_F7},;
    {K_ALT_F8,        xbeK_ALT_F8},;
    {K_ALT_F9,        xbeK_ALT_F9},;
    {K_ALT_F10,       xbeK_ALT_F10},;
    {K_F11,           xbeK_F11},;
    {K_F12,           xbeK_F12},;
    {K_SH_F11,        xbeK_SH_F11},;
    {K_SH_F12,        xbeK_SH_F12},;
    {K_CTRL_F11,      xbeK_CTRL_F11},;
    {K_CTRL_F12,      xbeK_CTRL_F12},;
    {K_ALT_F11,       xbeK_ALT_F11},;
    {K_ALT_F12,       xbeK_ALT_F12},;
    {K_CTRL_BS,       xbeK_CTRL_BS},;
    {K_ALT_BS,        xbeK_ALT_BS},;
    {K_SH_TAB,        xbeK_SH_TAB},;
    {K_ALT_Q,         xbeK_ALT_Q},;
    {K_ALT_W,         xbeK_ALT_W},;
    {K_ALT_E,         xbeK_ALT_E},;
    {K_ALT_R,         xbeK_ALT_R},;
    {K_ALT_T,         xbeK_ALT_T},;
    {K_ALT_Y,         xbeK_ALT_Y},;
    {K_ALT_U,         xbeK_ALT_U},;
    {K_ALT_I,         xbeK_ALT_I},;
    {K_ALT_O,         xbeK_ALT_O},;
    {K_ALT_P,         xbeK_ALT_P},;
    {K_ALT_ENTER,     xbeK_ALT_ENTER},;
    {K_ALT_A,         xbeK_ALT_A},;
    {K_ALT_S,         xbeK_ALT_S},;
    {K_ALT_D,         xbeK_ALT_D},;
    {K_ALT_F,         xbeK_ALT_F},;
    {K_ALT_G,         xbeK_ALT_G},;
    {K_ALT_H,         xbeK_ALT_H},;
    {K_ALT_J,         xbeK_ALT_J},;
    {K_ALT_K,         xbeK_ALT_K},;
    {K_ALT_L,         xbeK_ALT_L},;
    {K_ALT_Z,         xbeK_ALT_Z},;
    {K_ALT_X,         xbeK_ALT_X},;
    {K_ALT_C,         xbeK_ALT_C},;
    {K_ALT_V,         xbeK_ALT_V},;
    {K_ALT_B,         xbeK_ALT_B},;
    {K_ALT_N,         xbeK_ALT_N},;
    {K_ALT_M,         xbeK_ALT_M},;
    {KP_ALT_ASTERISK, xbeK_P_ALT_ASTERISK},;
    {KP_ALT_MINUS,    xbeK_P_ALT_MINUS},;
    {KP_ALT_PLUS,     xbeK_P_ALT_PLUS},;
    {K_ALT_1,         xbeK_ALT_1},;
    {K_ALT_2,         xbeK_ALT_2},;
    {K_ALT_3,         xbeK_ALT_3},;
    {K_ALT_4,         xbeK_ALT_4},;
    {K_ALT_5,         xbeK_ALT_5},;
    {K_ALT_6,         xbeK_ALT_6},;
    {K_ALT_7,         xbeK_ALT_7},;
    {K_ALT_8,         xbeK_ALT_8},;
    {K_ALT_9,         xbeK_ALT_9},;
    {K_ALT_0,         xbeK_ALT_0},;
    {K_ALT_EQUALS,    xbeK_ALT_EQUALS},;
    {K_CTRL_UP,       xbeK_CTRL_UP},;
    {KP_CTRL_MINUS,   xbeK_P_CTRL_MINUS},;
    {KP_CTRL_5,       xbeK_P_CTRL_5},;
    {KP_CTRL_PLUS,    xbeK_P_CTRL_PLUS},;
    {K_CTRL_DOWN,     xbeK_CTRL_DOWN},;
    {K_CTRL_INS,      xbeK_CTRL_INS},;
    {K_CTRL_DEL,      xbeK_CTRL_DEL},;
    {K_CTRL_TAB,      xbeK_CTRL_TAB},;
    {KP_CTRL_SLASH,   xbeK_P_CTRL_SLASH},;
    {KP_CTRL_ASTERISK,xbeK_P_CTRL_ASTERISK},;
    {K_ALT_HOME,      xbeK_ALT_HOME},;
    {K_ALT_UP,        xbeK_ALT_UP},;
    {K_ALT_PGUP,      xbeK_ALT_PGUP},;
    {K_ALT_LEFT,      xbeK_ALT_LEFT},;
    {K_ALT_RIGHT,     xbeK_ALT_RIGHT},;
    {K_ALT_END,       xbeK_ALT_END},;
    {K_ALT_DOWN,      xbeK_ALT_DOWN},;
    {K_ALT_PGDN,      xbeK_ALT_PGDN},;
    {K_ALT_INS,       xbeK_ALT_INS},;
    {K_ALT_DEL,       xbeK_ALT_DEL},;
    {KP_ALT_SLASH,    xbeK_P_ALT_SLASH},;
    {KP_ALT_ENTER,    xbeK_P_ALT_ENTER} ;
    }
  *
  nScan                         := ascan(aLookup,{|ele|ele[2]==nEvent})
  *
  IF nScan                      > 0
    *
    nInKey                      := aLookup[nScan][1]
    
  else
    
    nInKey                      := 0
    
  ENDIF
  
return nInkey
B.I.KaarigstadRe: LASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
on Fri, 25 Feb 2005 07:28:16 +0100
If I understand your problem correctly, I would go for a translator.
I use this where needed.

nTaste := event2inkey(LastAppEvent(@mp1))
....

function event2inkey(nEvent)
   do case
      case nEvent ==  xbeK_UP
         return K_UP
      case nEvent ==  xbeK_DOWN
         return K_DOWN
      case nEvent ==  xbeK_LEFT
         return K_LEFT
      case nEvent ==  xbeK_RIGHT
         return K_RIGHT
      case nEvent ==  xbeK_HOME
         return K_HOME
      case nEvent ==  xbeK_END
         return K_END
      case nEvent ==  xbeK_PGUP
         return K_PGUP
      case nEvent ==  xbeK_PGDN
         return K_PGDN
      case nEvent ==  xbeK_CTRL_UP
         return K_CTRL_UP
      case nEvent ==  xbeK_CTRL_DOWN
         return K_CTRL_DOWN
      case nEvent ==  xbeK_CTRL_LEFT
         return K_CTRL_LEFT
      case nEvent ==  xbeK_CTRL_RIGHT
         return K_CTRL_RIGHT
      case nEvent ==  xbeK_CTRL_HOME
         return K_CTRL_HOME
      case nEvent ==  xbeK_CTRL_END
         return K_CTRL_END
      case nEvent ==  xbeK_CTRL_PGUP
         return K_CTRL_PGUP
      case nEvent ==  xbeK_CTRL_PGDN
         return K_CTRL_PGDN
      case nEvent ==  xbeK_ALT_UP
         return K_ALT_UP
      case nEvent ==  xbeK_ALT_DOWN
         return K_ALT_DOWN
      case nEvent ==  xbeK_ALT_LEFT
         return K_ALT_LEFT
      case nEvent ==  xbeK_ALT_RIGHT
         return K_ALT_RIGHT
      case nEvent ==  xbeK_ALT_HOME
         return K_ALT_HOME
      case nEvent ==  xbeK_ALT_END
         return K_ALT_END
      case nEvent ==  xbeK_ALT_PGUP
         return K_ALT_PGUP
      case nEvent ==  xbeK_ALT_PGDN
         return K_ALT_PGDN
      case nEvent ==  xbeK_ENTER
         return K_ENTER
      case nEvent ==  xbeK_RETURN
         return K_RETURN
      case nEvent ==  xbeK_SPACE
         return K_SPACE
      case nEvent ==  xbeK_ESC
         return K_ESC
      case nEvent ==  xbeK_CTRL_ENTER
         return K_CTRL_ENTER
      case nEvent ==  xbeK_CTRL_RETURN
         return K_CTRL_RETURN
      case nEvent ==  xbeK_CTRL_RET
         return K_CTRL_RET
      case nEvent ==  xbeK_ALT_ENTER
         return K_ALT_ENTER
      case nEvent ==  xbeK_ALT_RETURN
         return K_ALT_RETURN
      case nEvent ==  xbeK_ALT_EQUALS
         return K_ALT_EQUALS
      case nEvent ==  xbeK_INS
         return K_INS
      case nEvent ==  xbeK_DEL
         return K_DEL
      case nEvent ==  xbeK_BS
         return K_BS
      case nEvent ==  xbeK_TAB
         return K_TAB
      case nEvent ==  xbeK_SH_TAB
         return K_SH_TAB
      case nEvent ==  xbeK_CTRL_TAB
         return K_CTRL_TAB
      case nEvent ==  xbeK_CTRL_INS
         return K_CTRL_INS
      case nEvent ==  xbeK_CTRL_DEL
         return K_CTRL_DEL
      case nEvent ==  xbeK_CTRL_BS
         return K_CTRL_BS
      case nEvent ==  xbeK_ALT_INS
         return K_ALT_INS
      case nEvent ==  xbeK_ALT_DEL
         return K_ALT_DEL
      case nEvent ==  xbeK_ALT_BS
         return K_ALT_BS
      case nEvent ==  xbeK_CTRL_A
         return K_CTRL_A
      case nEvent ==  xbeK_CTRL_B
         return K_CTRL_B
      case nEvent ==  xbeK_CTRL_C
         return K_CTRL_C
      case nEvent ==  xbeK_CTRL_D
         return K_CTRL_D
      case nEvent ==  xbeK_CTRL_E
         return K_CTRL_E
      case nEvent ==  xbeK_CTRL_F
         return K_CTRL_F
      case nEvent ==  xbeK_CTRL_G
         return K_CTRL_G
      case nEvent ==  xbeK_CTRL_H
         return K_CTRL_H
      case nEvent ==  xbeK_CTRL_I
         return K_CTRL_I
      case nEvent ==  xbeK_CTRL_J
         return K_CTRL_J
      case nEvent ==  xbeK_CTRL_K
         return K_CTRL_K
      case nEvent ==  xbeK_CTRL_L
         return K_CTRL_L
      case nEvent ==  xbeK_CTRL_M
         return K_CTRL_M
      case nEvent ==  xbeK_CTRL_N
         return K_CTRL_N
      case nEvent ==  xbeK_CTRL_O
         return K_CTRL_O
      case nEvent ==  xbeK_CTRL_P
         return K_CTRL_P
      case nEvent ==  xbeK_CTRL_Q
         return K_CTRL_Q
      case nEvent ==  xbeK_CTRL_R
         return K_CTRL_R
      case nEvent ==  xbeK_CTRL_S
         return K_CTRL_S
      case nEvent ==  xbeK_CTRL_T
         return K_CTRL_T
      case nEvent ==  xbeK_CTRL_U
         return K_CTRL_U
      case nEvent ==  xbeK_CTRL_V
         return K_CTRL_V
      case nEvent ==  xbeK_CTRL_W
         return K_CTRL_W
      case nEvent ==  xbeK_CTRL_X
         return K_CTRL_X
      case nEvent ==  xbeK_CTRL_Y
         return K_CTRL_Y
      case nEvent ==  xbeK_CTRL_Z
         return K_CTRL_Z
      case nEvent ==  xbeK_ALT_A
         return K_ALT_A
      case nEvent ==  xbeK_ALT_B
         return K_ALT_B
      case nEvent ==  xbeK_ALT_C
         return K_ALT_C
      case nEvent ==  xbeK_ALT_D
         return K_ALT_D
      case nEvent ==  xbeK_ALT_E
         return K_ALT_E
      case nEvent ==  xbeK_ALT_F
         return K_ALT_F
      case nEvent ==  xbeK_ALT_G
         return K_ALT_G
      case nEvent ==  xbeK_ALT_H
         return K_ALT_H
      case nEvent ==  xbeK_ALT_I
         return K_ALT_I
      case nEvent ==  xbeK_ALT_J
         return K_ALT_J
      case nEvent ==  xbeK_ALT_K
         return K_ALT_K
      case nEvent ==  xbeK_ALT_L
         return K_ALT_L
      case nEvent ==  xbeK_ALT_M
         return K_ALT_M
      case nEvent ==  xbeK_ALT_N
         return K_ALT_N
      case nEvent ==  xbeK_ALT_O
         return K_ALT_O
      case nEvent ==  xbeK_ALT_P
         return K_ALT_P
      case nEvent ==  xbeK_ALT_Q
         return K_ALT_Q
      case nEvent ==  xbeK_ALT_R
         return K_ALT_R
      case nEvent ==  xbeK_ALT_S
         return K_ALT_S
      case nEvent ==  xbeK_ALT_T
         return K_ALT_T
      case nEvent ==  xbeK_ALT_U
         return K_ALT_U
      case nEvent ==  xbeK_ALT_V
         return K_ALT_V
      case nEvent ==  xbeK_ALT_W
         return K_ALT_W
      case nEvent ==  xbeK_ALT_X
         return K_ALT_X
      case nEvent ==  xbeK_ALT_Y
         return K_ALT_Y
      case nEvent ==  xbeK_ALT_Z
         return K_ALT_Z
      case nEvent ==  xbeK_ALT_1
         return K_ALT_1
      case nEvent ==  xbeK_ALT_2
         return K_ALT_2
      case nEvent ==  xbeK_ALT_3
         return K_ALT_3
      case nEvent ==  xbeK_ALT_4
         return K_ALT_4
      case nEvent ==  xbeK_ALT_5
         return K_ALT_5
      case nEvent ==  xbeK_ALT_6
         return K_ALT_6
      case nEvent ==  xbeK_ALT_7
         return K_ALT_7
      case nEvent ==  xbeK_ALT_8
         return K_ALT_8
      case nEvent ==  xbeK_ALT_9
         return K_ALT_9
      case nEvent ==  xbeK_ALT_0
         return K_ALT_0
      case nEvent ==  xbeK_F1
         return K_F1
      case nEvent ==  xbeK_F2
         return K_F2
      case nEvent ==  xbeK_F3
         return K_F3
      case nEvent ==  xbeK_F4
         return K_F4
      case nEvent ==  xbeK_F5
         return K_F5
      case nEvent ==  xbeK_F6
         return K_F6
      case nEvent ==  xbeK_F7
         return K_F7
      case nEvent ==  xbeK_F8
         return K_F8
      case nEvent ==  xbeK_F9
         return K_F9
      case nEvent ==  xbeK_F10
         return K_F10
      case nEvent ==  xbeK_F11
         return K_F11
      case nEvent ==  xbeK_F12
         return K_F12
      case nEvent ==  xbeK_CTRL_F1
         return K_CTRL_F1
      case nEvent ==  xbeK_CTRL_F2
         return K_CTRL_F2
      case nEvent ==  xbeK_CTRL_F3
         return K_CTRL_F3
      case nEvent ==  xbeK_CTRL_F4
         return K_CTRL_F4
      case nEvent ==  xbeK_CTRL_F5
         return K_CTRL_F5
      case nEvent ==  xbeK_CTRL_F6
         return K_CTRL_F6
      case nEvent ==  xbeK_CTRL_F7
         return K_CTRL_F7
      case nEvent ==  xbeK_CTRL_F8
         return K_CTRL_F8
      case nEvent ==  xbeK_CTRL_F9
         return K_CTRL_F9
      case nEvent ==  xbeK_CTRL_F10
         return K_CTRL_F10
      case nEvent ==  xbeK_CTRL_F11
         return K_CTRL_F11
      case nEvent ==  xbeK_CTRL_F12
         return K_CTRL_F12
      case nEvent ==  xbeK_ALT_F1
         return K_ALT_F1
      case nEvent ==  xbeK_ALT_F2
         return K_ALT_F2
      case nEvent ==  xbeK_ALT_F3
         return K_ALT_F3
      case nEvent ==  xbeK_ALT_F4
         return K_ALT_F4
      case nEvent ==  xbeK_ALT_F5
         return K_ALT_F5
      case nEvent ==  xbeK_ALT_F6
         return K_ALT_F6
      case nEvent ==  xbeK_ALT_F7
         return K_ALT_F7
      case nEvent ==  xbeK_ALT_F8
         return K_ALT_F8
      case nEvent ==  xbeK_ALT_F9
         return K_ALT_F9
      case nEvent ==  xbeK_ALT_F10
         return K_ALT_F10
      case nEvent ==  xbeK_ALT_F11
         return K_ALT_F11
      case nEvent ==  xbeK_ALT_F12
         return K_ALT_F12
      case nEvent ==  xbeK_SH_F1
         return K_SH_F1
      case nEvent ==  xbeK_SH_F2
         return K_SH_F2
      case nEvent ==  xbeK_SH_F3
         return K_SH_F3
      case nEvent ==  xbeK_SH_F4
         return K_SH_F4
      case nEvent ==  xbeK_SH_F5
         return K_SH_F5
      case nEvent ==  xbeK_SH_F6
         return K_SH_F6
      case nEvent ==  xbeK_SH_F7
         return K_SH_F7
      case nEvent ==  xbeK_SH_F8
         return K_SH_F8
      case nEvent ==  xbeK_SH_F9
         return K_SH_F9
      case nEvent ==  xbeK_SH_F10
         return K_SH_F10
      case nEvent ==  xbeK_SH_F11
         return K_SH_F11
      case nEvent ==  xbeK_SH_F12
         return K_SH_F12

   endcase
   return nEvent

B.I.Kaarigstad

"AUGE_OHR" <AUGE_OHR@CSI.COM> skrev i melding 
news:dLHYafEFFHA.6152@S15147418...
> hi,
>
> i wanted the source be compatible with Cl*pper so i use #IFDEF __XPP__
>
> now i got a older Cl*pper Application with a lot of DBEDIT.
> each of them have a different UserUDF
>
> if i SetMouse(.T.) and use Xbase++ DBEDIT(), BROWSE() and use F2 -
> Fxx, how can i enhance it :
>
> #IFDEF __XPP__
>   IF SETMOUSE()
>      nTaste := LastAppEvent( @mp1 )
>   ELSE
>      nTaste := LASTKEY()
>   ENDIF
> #ELSE
>   nTaste := LASTKEY()
> #ENDIF
> ...
> DO CASE
>   CASE db_mode == 0
>   CASE db_mode == 1
>   CASE db_mode == 2
>   CASE db_mode == 3
>   CASE db_mode < 4
>   CASE nTaste == K_ESC   == xbeK_ESC == 27
>   CASE nTaste == K_F10    ???
>
> while K_F10 == -9  and xbeK_F1  ==  65648 ?
>
> CASE nTaste == K_F10 .or. nTaste == xbeK_F1
> is not a option, while a have only little room at Cl*pper DGROUP
> for more #define
>
> greetings by OHR
> Jimmy
>
>
AUGE_OHRRe: LASTKEY() vs. LastAppEvent( @mp1 ) with F2 - Fxx
on Fri, 25 Feb 2005 07:39:54 +0100
hi,

thx to both.

yes your are right, i need some kind of "translator" for xbeK_* -> K_*
... sometimes you do not see the tree in the wood

greetings by OHR
Jimmy



"B.I.Kaarigstad" <bkaarigs_at_online_dot_no> schrieb im Newsbeitrag
news:S7VjyMwGFHA.1256@S15147418...
> If I understand your problem correctly, I would go for a translator.
> I use this where needed.
>
> nTaste := event2inkey(LastAppEvent(@mp1))
> ....
>
> function event2inkey(nEvent)
>    do case
>       case nEvent ==  xbeK_UP
>          return K_UP
>       case nEvent ==  xbeK_DOWN
>          return K_DOWN
>       case nEvent ==  xbeK_LEFT
>          return K_LEFT
>       case nEvent ==  xbeK_RIGHT
>          return K_RIGHT
>       case nEvent ==  xbeK_HOME
>          return K_HOME
>       case nEvent ==  xbeK_END
>          return K_END
>       case nEvent ==  xbeK_PGUP
>          return K_PGUP
>       case nEvent ==  xbeK_PGDN
>          return K_PGDN
>       case nEvent ==  xbeK_CTRL_UP
>          return K_CTRL_UP
>       case nEvent ==  xbeK_CTRL_DOWN
>          return K_CTRL_DOWN
>       case nEvent ==  xbeK_CTRL_LEFT
>          return K_CTRL_LEFT
>       case nEvent ==  xbeK_CTRL_RIGHT
>          return K_CTRL_RIGHT
>       case nEvent ==  xbeK_CTRL_HOME
>          return K_CTRL_HOME
>       case nEvent ==  xbeK_CTRL_END
>          return K_CTRL_END
>       case nEvent ==  xbeK_CTRL_PGUP
>          return K_CTRL_PGUP
>       case nEvent ==  xbeK_CTRL_PGDN
>          return K_CTRL_PGDN
>       case nEvent ==  xbeK_ALT_UP
>          return K_ALT_UP
>       case nEvent ==  xbeK_ALT_DOWN
>          return K_ALT_DOWN
>       case nEvent ==  xbeK_ALT_LEFT
>          return K_ALT_LEFT
>       case nEvent ==  xbeK_ALT_RIGHT
>          return K_ALT_RIGHT
>       case nEvent ==  xbeK_ALT_HOME
>          return K_ALT_HOME
>       case nEvent ==  xbeK_ALT_END
>          return K_ALT_END
>       case nEvent ==  xbeK_ALT_PGUP
>          return K_ALT_PGUP
>       case nEvent ==  xbeK_ALT_PGDN
>          return K_ALT_PGDN
>       case nEvent ==  xbeK_ENTER
>          return K_ENTER
>       case nEvent ==  xbeK_RETURN
>          return K_RETURN
>       case nEvent ==  xbeK_SPACE
>          return K_SPACE
>       case nEvent ==  xbeK_ESC
>          return K_ESC
>       case nEvent ==  xbeK_CTRL_ENTER
>          return K_CTRL_ENTER
>       case nEvent ==  xbeK_CTRL_RETURN
>          return K_CTRL_RETURN
>       case nEvent ==  xbeK_CTRL_RET
>          return K_CTRL_RET
>       case nEvent ==  xbeK_ALT_ENTER
>          return K_ALT_ENTER
>       case nEvent ==  xbeK_ALT_RETURN
>          return K_ALT_RETURN
>       case nEvent ==  xbeK_ALT_EQUALS
>          return K_ALT_EQUALS
>       case nEvent ==  xbeK_INS
>          return K_INS
>       case nEvent ==  xbeK_DEL
>          return K_DEL
>       case nEvent ==  xbeK_BS
>          return K_BS
>       case nEvent ==  xbeK_TAB
>          return K_TAB
>       case nEvent ==  xbeK_SH_TAB
>          return K_SH_TAB
>       case nEvent ==  xbeK_CTRL_TAB
>          return K_CTRL_TAB
>       case nEvent ==  xbeK_CTRL_INS
>          return K_CTRL_INS
>       case nEvent ==  xbeK_CTRL_DEL
>          return K_CTRL_DEL
>       case nEvent ==  xbeK_CTRL_BS
>          return K_CTRL_BS
>       case nEvent ==  xbeK_ALT_INS
>          return K_ALT_INS
>       case nEvent ==  xbeK_ALT_DEL
>          return K_ALT_DEL
>       case nEvent ==  xbeK_ALT_BS
>          return K_ALT_BS
>       case nEvent ==  xbeK_CTRL_A
>          return K_CTRL_A
>       case nEvent ==  xbeK_CTRL_B
>          return K_CTRL_B
>       case nEvent ==  xbeK_CTRL_C
>          return K_CTRL_C
>       case nEvent ==  xbeK_CTRL_D
>          return K_CTRL_D
>       case nEvent ==  xbeK_CTRL_E
>          return K_CTRL_E
>       case nEvent ==  xbeK_CTRL_F
>          return K_CTRL_F
>       case nEvent ==  xbeK_CTRL_G
>          return K_CTRL_G
>       case nEvent ==  xbeK_CTRL_H
>          return K_CTRL_H
>       case nEvent ==  xbeK_CTRL_I
>          return K_CTRL_I
>       case nEvent ==  xbeK_CTRL_J
>          return K_CTRL_J
>       case nEvent ==  xbeK_CTRL_K
>          return K_CTRL_K
>       case nEvent ==  xbeK_CTRL_L
>          return K_CTRL_L
>       case nEvent ==  xbeK_CTRL_M
>          return K_CTRL_M
>       case nEvent ==  xbeK_CTRL_N
>          return K_CTRL_N
>       case nEvent ==  xbeK_CTRL_O
>          return K_CTRL_O
>       case nEvent ==  xbeK_CTRL_P
>          return K_CTRL_P
>       case nEvent ==  xbeK_CTRL_Q
>          return K_CTRL_Q
>       case nEvent ==  xbeK_CTRL_R
>          return K_CTRL_R
>       case nEvent ==  xbeK_CTRL_S
>          return K_CTRL_S
>       case nEvent ==  xbeK_CTRL_T
>          return K_CTRL_T
>       case nEvent ==  xbeK_CTRL_U
>          return K_CTRL_U
>       case nEvent ==  xbeK_CTRL_V
>          return K_CTRL_V
>       case nEvent ==  xbeK_CTRL_W
>          return K_CTRL_W
>       case nEvent ==  xbeK_CTRL_X
>          return K_CTRL_X
>       case nEvent ==  xbeK_CTRL_Y
>          return K_CTRL_Y
>       case nEvent ==  xbeK_CTRL_Z
>          return K_CTRL_Z
>       case nEvent ==  xbeK_ALT_A
>          return K_ALT_A
>       case nEvent ==  xbeK_ALT_B
>          return K_ALT_B
>       case nEvent ==  xbeK_ALT_C
>          return K_ALT_C
>       case nEvent ==  xbeK_ALT_D
>          return K_ALT_D
>       case nEvent ==  xbeK_ALT_E
>          return K_ALT_E
>       case nEvent ==  xbeK_ALT_F
>          return K_ALT_F
>       case nEvent ==  xbeK_ALT_G
>          return K_ALT_G
>       case nEvent ==  xbeK_ALT_H
>          return K_ALT_H
>       case nEvent ==  xbeK_ALT_I
>          return K_ALT_I
>       case nEvent ==  xbeK_ALT_J
>          return K_ALT_J
>       case nEvent ==  xbeK_ALT_K
>          return K_ALT_K
>       case nEvent ==  xbeK_ALT_L
>          return K_ALT_L
>       case nEvent ==  xbeK_ALT_M
>          return K_ALT_M
>       case nEvent ==  xbeK_ALT_N
>          return K_ALT_N
>       case nEvent ==  xbeK_ALT_O
>          return K_ALT_O
>       case nEvent ==  xbeK_ALT_P
>          return K_ALT_P
>       case nEvent ==  xbeK_ALT_Q
>          return K_ALT_Q
>       case nEvent ==  xbeK_ALT_R
>          return K_ALT_R
>       case nEvent ==  xbeK_ALT_S
>          return K_ALT_S
>       case nEvent ==  xbeK_ALT_T
>          return K_ALT_T
>       case nEvent ==  xbeK_ALT_U
>          return K_ALT_U
>       case nEvent ==  xbeK_ALT_V
>          return K_ALT_V
>       case nEvent ==  xbeK_ALT_W
>          return K_ALT_W
>       case nEvent ==  xbeK_ALT_X
>          return K_ALT_X
>       case nEvent ==  xbeK_ALT_Y
>          return K_ALT_Y
>       case nEvent ==  xbeK_ALT_Z
>          return K_ALT_Z
>       case nEvent ==  xbeK_ALT_1
>          return K_ALT_1
>       case nEvent ==  xbeK_ALT_2
>          return K_ALT_2
>       case nEvent ==  xbeK_ALT_3
>          return K_ALT_3
>       case nEvent ==  xbeK_ALT_4
>          return K_ALT_4
>       case nEvent ==  xbeK_ALT_5
>          return K_ALT_5
>       case nEvent ==  xbeK_ALT_6
>          return K_ALT_6
>       case nEvent ==  xbeK_ALT_7
>          return K_ALT_7
>       case nEvent ==  xbeK_ALT_8
>          return K_ALT_8
>       case nEvent ==  xbeK_ALT_9
>          return K_ALT_9
>       case nEvent ==  xbeK_ALT_0
>          return K_ALT_0
>       case nEvent ==  xbeK_F1
>          return K_F1
>       case nEvent ==  xbeK_F2
>          return K_F2
>       case nEvent ==  xbeK_F3
>          return K_F3
>       case nEvent ==  xbeK_F4
>          return K_F4
>       case nEvent ==  xbeK_F5
>          return K_F5
>       case nEvent ==  xbeK_F6
>          return K_F6
>       case nEvent ==  xbeK_F7
>          return K_F7
>       case nEvent ==  xbeK_F8
>          return K_F8
>       case nEvent ==  xbeK_F9
>          return K_F9
>       case nEvent ==  xbeK_F10
>          return K_F10
>       case nEvent ==  xbeK_F11
>          return K_F11
>       case nEvent ==  xbeK_F12
>          return K_F12
>       case nEvent ==  xbeK_CTRL_F1
>          return K_CTRL_F1
>       case nEvent ==  xbeK_CTRL_F2
>          return K_CTRL_F2
>       case nEvent ==  xbeK_CTRL_F3
>          return K_CTRL_F3
>       case nEvent ==  xbeK_CTRL_F4
>          return K_CTRL_F4
>       case nEvent ==  xbeK_CTRL_F5
>          return K_CTRL_F5
>       case nEvent ==  xbeK_CTRL_F6
>          return K_CTRL_F6
>       case nEvent ==  xbeK_CTRL_F7
>          return K_CTRL_F7
>       case nEvent ==  xbeK_CTRL_F8
>          return K_CTRL_F8
>       case nEvent ==  xbeK_CTRL_F9
>          return K_CTRL_F9
>       case nEvent ==  xbeK_CTRL_F10
>          return K_CTRL_F10
>       case nEvent ==  xbeK_CTRL_F11
>          return K_CTRL_F11
>       case nEvent ==  xbeK_CTRL_F12
>          return K_CTRL_F12
>       case nEvent ==  xbeK_ALT_F1
>          return K_ALT_F1
>       case nEvent ==  xbeK_ALT_F2
>          return K_ALT_F2
>       case nEvent ==  xbeK_ALT_F3
>          return K_ALT_F3
>       case nEvent ==  xbeK_ALT_F4
>          return K_ALT_F4
>       case nEvent ==  xbeK_ALT_F5
>          return K_ALT_F5
>       case nEvent ==  xbeK_ALT_F6
>          return K_ALT_F6
>       case nEvent ==  xbeK_ALT_F7
>          return K_ALT_F7
>       case nEvent ==  xbeK_ALT_F8
>          return K_ALT_F8
>       case nEvent ==  xbeK_ALT_F9
>          return K_ALT_F9
>       case nEvent ==  xbeK_ALT_F10
>          return K_ALT_F10
>       case nEvent ==  xbeK_ALT_F11
>          return K_ALT_F11
>       case nEvent ==  xbeK_ALT_F12
>          return K_ALT_F12
>       case nEvent ==  xbeK_SH_F1
>          return K_SH_F1
>       case nEvent ==  xbeK_SH_F2
>          return K_SH_F2
>       case nEvent ==  xbeK_SH_F3
>          return K_SH_F3
>       case nEvent ==  xbeK_SH_F4
>          return K_SH_F4
>       case nEvent ==  xbeK_SH_F5
>          return K_SH_F5
>       case nEvent ==  xbeK_SH_F6
>          return K_SH_F6
>       case nEvent ==  xbeK_SH_F7
>          return K_SH_F7
>       case nEvent ==  xbeK_SH_F8
>          return K_SH_F8
>       case nEvent ==  xbeK_SH_F9
>          return K_SH_F9
>       case nEvent ==  xbeK_SH_F10
>          return K_SH_F10
>       case nEvent ==  xbeK_SH_F11
>          return K_SH_F11
>       case nEvent ==  xbeK_SH_F12
>          return K_SH_F12
>
>    endcase
>    return nEvent
>
> B.I.Kaarigstad
>
> "AUGE_OHR" <AUGE_OHR@CSI.COM> skrev i melding
> news:dLHYafEFFHA.6152@S15147418...
> > hi,
> >
> > i wanted the source be compatible with Cl*pper so i use #IFDEF __XPP__
> >
> > now i got a older Cl*pper Application with a lot of DBEDIT.
> > each of them have a different UserUDF
> >
> > if i SetMouse(.T.) and use Xbase++ DBEDIT(), BROWSE() and use F2 -
> > Fxx, how can i enhance it :
> >
> > #IFDEF __XPP__
> >   IF SETMOUSE()
> >      nTaste := LastAppEvent( @mp1 )
> >   ELSE
> >      nTaste := LASTKEY()
> >   ENDIF
> > #ELSE
> >   nTaste := LASTKEY()
> > #ENDIF
> > ...
> > DO CASE
> >   CASE db_mode == 0
> >   CASE db_mode == 1
> >   CASE db_mode == 2
> >   CASE db_mode == 3
> >   CASE db_mode < 4
> >   CASE nTaste == K_ESC   == xbeK_ESC == 27
> >   CASE nTaste == K_F10    ???
> >
> > while K_F10 == -9  and xbeK_F1  ==  65648 ?
> >
> > CASE nTaste == K_F10 .or. nTaste == xbeK_F1
> > is not a option, while a have only little room at Cl*pper DGROUP
> > for more #define
> >
> > greetings by OHR
> > Jimmy
> >
> >
>
>