I am having some problems getting this code to work. Hope someone can help me. What I am trying to do is have the form keypress event enter a value of 10 in any text box on Page three of a pageframe (named PgfRelated) if I hit the 0 key, then move to the next text box. The other number keys (1 thru 9) enter their values normally, and then move to the next text box.
Here is my code I am trying...
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL lcWord
IF (THISFORM.PgfRelated.ActivePage = 3) THEN
m.loActiveControl = THISFORM.PgfRelated.Page3.ActiveControl
lcWord = m.loActiveControl.Value
DO CASE
CASE nKeyCode = 48
lcWord = 10
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 57
lcWord = 9
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 56
lcWord = 8
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 55
lcWord = 7
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 54
lcWord = 6
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 53
lcWord = 5
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 52
lcWord = 4
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 51
lcWord = 3
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 50
lcWord = 2
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 49
lcWord = 1
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
ENDCASE
ENDIF
I have used code similar to this on a form without a pageframe, and it works well. My problem seems to be the pageframe. My reference does not work properly or something.
Here is my code I am trying...
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL lcWord
IF (THISFORM.PgfRelated.ActivePage = 3) THEN
m.loActiveControl = THISFORM.PgfRelated.Page3.ActiveControl
lcWord = m.loActiveControl.Value
DO CASE
CASE nKeyCode = 48
lcWord = 10
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 57
lcWord = 9
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 56
lcWord = 8
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 55
lcWord = 7
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 54
lcWord = 6
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 53
lcWord = 5
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 52
lcWord = 4
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 51
lcWord = 3
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 50
lcWord = 2
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
CASE nKeyCode = 49
lcWord = 1
m.loActiveControl.Value = lcWord
KEYBOARD '{TAB}'
NODEFAULT
ENDCASE
ENDIF
I have used code similar to this on a form without a pageframe, and it works well. My problem seems to be the pageframe. My reference does not work properly or something.