Page 1 of 2

Key code

PostPosted: Mon Nov 24, 2014 6:08 pm
by Silvio.Falconi
I need the key code number for Pagup and Pagdown
I saw on inkey and I tried

elseif nKey == K_PGUP


elseif nKey == K_PGDN

but it not run ok

Regards

Re: Key code

PostPosted: Mon Nov 24, 2014 6:44 pm
by ukoenig
Silvio,

You can try :

Code: Select all  Expand view

#include "FiveWin.ch"

function main()
local oWnd

DEFINE WINDOW oWnd TITLE "Keys"

oWnd:bKeyDown := { | nKey | IIF( nKey = 33, MsgInfo( "Page UP : " + Str( nKey ) ), ), ;
                            IIF( nKey = 34, MsgInfo( "Page DOWN : " + Str( nKey ) ), ) }

ACTIVATE WINDOW oWnd

RETURN ( NIL )
 


Best regards
Uwe :?:

Re: Key code

PostPosted: Tue Nov 25, 2014 11:21 am
by Silvio.Falconi
Uwe,
If I press from 1 to 9 on keyboard give me from 49 to 57

but I need the key code of the numbers of keypad

any help ?


Please try and paste this function with msgcalc()
Code: Select all  Expand view
STATIC FUNCTION VerKey(nKey,oBSum, oBMin, oBMol, oBDiv, oBPer, oBCan, oBRes)
if      nKey   == 107      // "+"
      oBSum:Click()
elseif   nKey   == 109      // "-"
      oBMin:Click()
elseif   nKey   == 106      // "*"
      oBMol:Click()
elseif   nKey   == 111      // "/"
      oBDiv:Click()
     
     elseif nKey ==  105
           oBt9:click()
      elseif nKey ==  104
           oBt8:click()
      elseif nKey ==  103
           oBt7:click()
        elseif nKey ==  102
          ? chr(nkey)
           oBt6:click()
      elseif nKey ==  101
           oBt5:click()
      elseif nKey ==  100
           oBt4:click()
      elseif nKey ==  99   .or. nkey== 51
           oBt3:click()
      elseif nKey ==  98   .or. nkey== 50
           oBt2:click()
      elseif nKey ==  97   .or. nkey== 49
           oBt1:click()    


     
     
     
end
RETU 0



for sample to understan the problem

If you press 1 (on keynumpad or on keyboard) the msgcalc write 1 on get

then if you press 2 then the msgcalc not write on get the number 2

only if you press C then the button "2" can run ok

how I can resolve ?

Re: Key code

PostPosted: Tue Nov 25, 2014 11:48 am
by Enrico Maria Giordano
Silvio,

Code: Select all  Expand view
#define VK_NUMPAD0   96
#define VK_NUMPAD1   97
#define VK_NUMPAD2   98
#define VK_NUMPAD3   99
#define VK_NUMPAD4   100
#define VK_NUMPAD5   101
#define VK_NUMPAD6   102
#define VK_NUMPAD7   103
#define VK_NUMPAD8   104
#define VK_NUMPAD9   105


EMG

Re: Key code

PostPosted: Tue Nov 25, 2014 11:54 am
by Silvio.Falconi
Emg,
please read the previous message

Re: Key code

PostPosted: Tue Nov 25, 2014 12:16 pm
by Silvio.Falconi
the error is on SayNum(oGet,xNum) function of msgcalc

if we use button on numpad msgcalc write the number allway at first position

Re: Key code

PostPosted: Tue Nov 25, 2014 1:12 pm
by Jeff Barnes

Re: Key code

PostPosted: Tue Nov 25, 2014 4:57 pm
by karinha
Code: Select all  Expand view

   elseif nKey ==  34 //PAGE DOWN in vkey.ch

      ? [PAGE DOWN]

   elseif nKey ==  33 //PAGE UP   In vkey.ch

      ? [PAGE UP]
 



Re: Key code

PostPosted: Tue Nov 25, 2014 5:30 pm
by Silvio.Falconi
friends I 'm trying to correct the msgcalc and use it on win 7 and win 8

the numkey are right

Now I saw the SayNum(oGet,xNum) function of msgcalc

this is compatible if the user press the buttons of odlg

this is not compatible if the user press the numpad keys of keyboard


because I need to simulate the click of the button on the dialog
sample :

elseif nKey == VK_NUMPAD9
oBt9:click()

it write the number allways on first position

if we digit ( press on numpad) the sequence 123 you see on get 323

I not Know why

sample: pressing a sequence from 1 to 9

If I press dialog button I see

Image


If I press numpad button I see

Image

Re: Key code

PostPosted: Tue Nov 25, 2014 5:49 pm
by karinha
if I understand,

Code: Select all  Expand view

   elseif nKey == 105 //VK_NUMPAD9 - in vkey.ch
      oBt9:click()
 

Re: Key code

PostPosted: Tue Nov 25, 2014 6:01 pm
by Silvio.Falconi
karinha,
the nkey are right

try msgcalc please

and use only the numbers you found on numpad of your keyboard NOT USE dialog buttons ( od msgcalc) and see what happen

Code: Select all  Expand view

STATIC FUNCTION VerKey(nKey,oBSum, oBMin, oBMol, oBDiv, oBPer, ;
                       oBCan, oBRes, oBivap, oBIvam, oBtnPast,oBt1,oBt2,oBt3,oBt4,oBt5,oBt6,oBt7,oBt8,oBt9,oBt0)
if      nKey   == 107      // "+"
      oBSum:Click()
elseif   nKey   == 109      // "-"
      oBMin:Click()
elseif   nKey   == 106      // "*"
      oBMol:Click()
elseif   nKey   == 111      // "/"
   oBDiv:Click()


  elseif  nKey == 008     // BackSpace
        oBtnPast:Click()

  elseif nKey == 067     // C
     oBCan:Click()



      elseif nKey ==   VK_NUMPAD9
           oBt9:click()
      elseif nKey == VK_NUMPAD8
           oBt8:click()
      elseif nKey ==  VK_NUMPAD7
           oBt7:click()
        elseif nKey ==  VK_NUMPAD6
           oBt6:click()
      elseif nKey ==  VK_NUMPAD5
           oBt5:click()
      elseif nKey ==  VK_NUMPAD4
           oBt4:click()
      elseif nKey ==  VK_NUMPAD3
           oBt3:click()
      elseif nKey ==  VK_NUMPAD2
           oBt2:click()
      elseif nKey ==  VK_NUMPAD1
           oBt1:click()
       elseif nKey ==  VK_NUMPAD0
           oBt0:click()

end
RETU 0



 

Re: Key code

PostPosted: Tue Nov 25, 2014 6:40 pm
by karinha
Sorry, My version does not have this calculator.

See \samples\ TCALC.PRG if it is not better to control.

Regards.

Re: Key code

PostPosted: Tue Nov 25, 2014 7:59 pm
by Silvio.Falconi
It is a function from fw 1.4
.\source\function\msgcalc.prg

Re: Key code

PostPosted: Wed Nov 26, 2014 11:40 am
by karinha

Re: Key code

PostPosted: Wed Nov 26, 2014 11:46 am
by karinha
Show your MsgCalc.prg

For I compare with my

What does not work?

Regards.