> I could do it in a messy way by moving the cursor off the field and back
> again - but I can't work out how to move the cursor in a Browse screen
> under programme control except by changing records (and this doesn't
> work either - I suppose because the screen only updates when it becomes
> visible again after the code has run and I have moved the record back
> to its original place by this time!)
> I guess there is a simple answer somewhere ....... !
Okay, there's a hard way to get the cursor off the field, and back on the
field again, and it involves using the WHEN statement to decide which
field to land on. What you have to do is
1. remember which field you want to land on: s_targ_fld
2. create a public logical var that says you are doing this: l_fld_skip
3. buffer TAB's using KEYBOARD tab
So after you do your WHEN routine and change the value of the field,
KEYBOARD '{TAB}' and set l_fld_skip = .T.
* Each browse field has in its WHEN routine:
IF s_targ_fld # VARREAD() AND l_fld_skip && wrong field
KEYBOARD '{TAB}' && keep going round robin thru all the fields until
&& you land on the right one
RETURN .F. (won't allow FP to land on this field, goto next one
ELSE
SET TYPEAHEAD TO 0
CLEAR TYPEAHEAD
SET TYPEAHEAD TO 128
l_fld_skip = .T.
s_targ_fld = ''
RETURN .T.
ENDIF
It's a kludge, but the cursor will never show on the other fields until
the one you want returns a true in the WHEN routine. Of course, you could
try KEYBOARD '{TAB}' KEYBOARD '{SHIFT+TAB}' and achieve the same effect,
but perhaps a bit more noticable by the enduser.
If you send some sample code, I might be able to see what it is exactly
you are trying to do and come up with a better approach....