Forcing rinput to focus on the next empty field

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Mikhail
Posts: 87
Joined: Tue Jul 07, 2009 10:26 am
Location: Ukraine

Forcing rinput to focus on the next empty field

Post by Mikhail »

Suppose we have the following code:
!====================
do
rinput #win, fields mat inputspecs$: mat inputs$
if inputs$(1) = ... then do something
if inputs$(2) = ... then do something else
.
.
loop until fkey = 99
!====================
How can I make the rinput focus on a specific field, and not necessarily the same one each time the loop repeats?
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

You could create a function

FNBLANKFIELD$(INSPEC$,mat INFIELD$)

Where INSPEC$ is a string of C's and N's for type of data and mat infield is the data contents. FNBLANKFIELD would return a string of 1's and 0's if the field was populated or blank.

Then using a POS statement set the value of CURFLD to the next 0 before completing the loop.

let curfld(pos(fnblankfield$,mat infield$),"0",curfld)
loop

this should set the cursor at the next balnk field after the current one, or by making the second curfld=0 it would be the first blank field

FNGeorge
Post Reply