Move Cursor within noshow/endnoshow?

Small procedure that starts in first field, does a few tweaks in the last field then finally, uses the field statement to focus/park the cursor back on the first field. If I encapsulate the procedure with noshow & endnoshow the cursor ends up parked on the last field. If I move the field statement after the endnoshow then it responds as expected parked on the first field.

I’m seeing similar in a simple test database with 7 fields titled “A” thru “G” and I run this code

    field "A"
    field "G"
    field "A"
message info("fieldname")

I find that the message dialog shows field A being the current field as expected from the procedure. But, what’s displayed on the data sheet after the dialog is dismissed is whatever field was selected when the procedure was called is still the selected field, and running info(“fieldname”) in the formula workshop shows that the selected field on the screen is the current field. So PanX is resetting the current field back to the original selection after the procedure is done.

Since placing the final “field” statement outside of the noshow block results in the expected behavior as you indicated, I’m not sure if the observed phenomenon when the “field” statement is executed within the noshow block is a bug, a feature, or just how things are??

I have the same problem. Field statement inside a noshow to endnoshow loop does not function. This entire loop doesn’t work when inside the noshow loop. If the noshow and endnoshow are commented, then all works as expected.

local ii, cc

for ii, 1, info(“fieldcount”)
field val(ii)
cc = «»
fieldname cc



I think it is not the field statement that is misbehaving, but the fieldname statement. Can’t have display turned off when you change the field name, sorry.

I have good news though, you can replace all your code with two lines!

setfieldnames exportline()