>>>>>I use the up & downarrow keys to toggle through records. With FPW I could use the
>>>>>_CUROBJ=OBJNUM(FieldName) to return the cursor to the current field. I know with
>>>>>VFP5 I should use the ActiveControl property but I'm not sure how it's used. I'm
>>>>>inserting the code in the keypress method.
>>>>>
>>>>>TIA
>>>>>
>>>>>Chris
>>>>
>>>>If you gonna do something with other objects and then return to curobj set a form property to hold the reference - say oCurObject :
>>>>
>>>>*
>>>>* Keypress event
>>>>thisform.oCurObject = this && Save the reference
>>>>...
>>>>thisform.oCurObject.setfocus()
>>>
>>>I have 3 text boxes on the form (Text1, Text2, Text3)
>>>
>>>I tried this in the keypress event for Text2
>>>
>>>IF nKeyCode=24
>>> SKIP 1
>>> IF EOF()
>>> GO BOTTOM
>>> ENDIF
>>> This.Text2.SetFocus
>>>ENDIF
>>>
>>>It jumps to the next field (Text3 - tabindex 3) but
>>>if I use this in keypress event
>>>
>>>IF nKeyCode=24
>>> SKIP 1
>>> IF EOF()
>>> GO BOTTOM
>>> ENDIF
>>> This.Text1.SetFocus
>>>ENDIF
>>>
>>>It returns the cursor to Text2. Is there a way I could say return cursor
>>>to TabIndex-1 or am I just missing something?
>>nKeyCode= 24 DnArrow ? Well doesn't matter.
>>Just add a "nodefault" after if ..
>
>I'm not sure if I follow you on this one. nKeyCode is a keypress parameter and
>24 is INKEY() value for the DnArrow. I'm using a CASE statement because I check
>for other keypress values but for simplicity I used an IF example.
>
>So for the above code I would press the DnArrow key, display the next value and
>return to the Text2 object.
what is special with it is when you press dnarrow and call setfocus, focus is set to text2 and than normal (default) behaviour of DnArrow is executed. You should somewhat absorb it (nodefault) if you don't want it to happen. It is like with no keypress you are in text2 pressing dnarrow.
In "do case" also you should use "nodefault" after "case" statement if you don't want the default behaviour of key.
*keypress
do case
case nKeycode = 28
..
thisform.oObject.setfocus
case nKeyCode = 122
nodefault
thisform.oObject.setfocus
...
endcase