Re: Help for handle "Input Array"
Posted in 1998
Hello, Earnest
Try to use input array in while true ... end while loop. Using arr_curr()
and arr_count() you can check arr_curr()=arr_count().
Below is the sample program you can use as a clue.
database mces
main
define
ar_it array[500] of record
it char(30)
end record,
cntr integer,
ind integer,
scr integer,
tot integer,
it_c char(30),
ptr smallint
defer interrupt
declare cur_it cursor for
select item_num from item_div where div_code="CTV"
for cntr=1 to 500
let ar_it[cntr].it =""
end for
let cntr = 1
foreach cur_it into it_c
let ar_it[cntr].it = it_c
let cntr=cntr + 1
if cntr >500 then
exit foreach
end if
end foreach
call set_count(cntr-1)
open window w1 at 7,7 with form "f1" attributes(border)
let ptr=0
while true
input array ar_it without defaults from sc_it.*
before row
let ind=arr_curr()
display ind
let tot = arr_count()
let scr = scr_line()
if ind+1 > tot then
display ar_it[ind].it to sc_it[scr].item_num
let ptr = 0
exit input
end if
on key(esc)
let ptr=1
exit input
on key (interrupt)
exit input
end input
if int_flag then
let int_flag=false
exit while
end if
if ptr = 0 then
continue while
else
exit while
end if
end while
close window w1
end main
# =========================================================
CheungYip San <monitor@topaz.hknet.com> '''''''' ' ''''''
<35f3d717.0@ruby.hknet.com>...
> Hello all informix 4GL users,
>
> I am writing the Informix 4GL program and try to
> using the "Input Array" to display and modify the
> program array on the screen.
>
> But I don't know how to control the program to stay
> on the last item of program array. Since the cursor
> will move to a new blank row after the user press
> the <Down> or <Enter> key at the last containing
> data row.
>
> This program just only use to modify the existing
> data, I won't want the user to insert any new
> row to the array.
>
> Thank for all if you know how to help me.
>
>
> Earnest
>
>