4GL Array Cursor Position?
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
On SE 7.23, 4GL 6.04 SCO Unix 5.04: I have developed a menu program that is a series of INPUT ARRAY statements. There are different size windows opened depending on the number of menu items read from the DB. My problem is this: When I close a window where the cursor was say on line 6 of the array and the window beneath it only has 3 lines, I get a subscript out of bounds error because there is no line 6 on the preceeding window that now has the active INPUT ARRAY. Is there a way to manipulate the cursor(to say line 1) before I issue an EXIT INPUT/END INPUT and CLOSE WINDOW statement? I have an invisible field on each line of the window and tried using a series of NEXT FIELD PREVIOUS statements like this to get the cursor to line 1: WHILE arr_curr() > 1 NEXT FIELD PREVIOUS END WHILE This works from the AFTER FIELD clause of the INPUT ARRAY, but when I try to use it from the ON KEY(RETURN) clause, the the next statement executed is the INPUT ARRAY again. Any Ideas? Thanks, Matt Brickley
Hi! Matt Brickley wrote: > On SE 7.23, 4GL 6.04 SCO Unix 5.04: > I have developed a menu program that is a series of INPUT ARRAY > statements. > There are different size windows opened depending on the number of menu > items read from the DB. My problem is this: What I am wondering is how did you manage to create different-sized INPUT ARRAYS? Do you have a BUNCH of different forms for this? > When I close a window where the cursor was say on line 6 of the array > and the window > beneath it only has 3 lines, I get a subscript out of bounds error > because there is no > line 6 on the preceeding window that now has the active INPUT ARRAY. > Is there a way to manipulate the cursor(to say line 1) before I issue an > EXIT INPUT/END INPUT and CLOSE WINDOW statement? If you sure that you have finished INPUT ARRAY before CLOSE WINDOW, then INPUT ARRAY in parent window should work OK. But ... 1) Have you tried to run set_count() for parent window after closing nested one? 2) Again, I don't know how did you organized multi-level menus. I have OnLine 7.20/4GL 6.04/Solaris 2.5.1 and Informix has really unpredictable behaviour while running nested INPUTs/INPUT ARRAYs in SAME function. But, if you call other function with INPUT ARRAY from current INPUT ARRAY, it seems to be OK. > I have an invisible field on each line of the window and tried using a > series of > NEXT FIELD PREVIOUS statements like this to get the cursor to line 1: > > WHILE arr_curr() > 1 > NEXT FIELD PREVIOUS > END WHILE Why you just don't EXIT INPUT/set_count()/INPUT ARRAY again. This WILL work in ON KEY as well and will move cursor to first line. > > This works from the AFTER FIELD clause of the INPUT ARRAY, but when I > try to use > it from the ON KEY(RETURN) clause, the the next statement executed is > the INPUT ARRAY again. > > Any Ideas? > Thanks, > Matt Brickley With best regards, --- Yury V. Kamsha yura@pict.lviv.ua You can't win, you can't even lose, you even can not quit the game.
Matt Brickley wrote: > > On SE 7.23, 4GL 6.04 SCO Unix 5.04: > I have developed a menu program that is a series of INPUT ARRAY > statements. > There are different size windows opened depending on the number of menu > items > read from the DB. My problem is this: > When I close a window where the cursor was say on line 6 of the array > and the window > beneath it only has 3 lines, I get a subscript out of bounds error > because there is no > line 6 on the preceeding window that now has the active INPUT ARRAY. > Is there a way to manipulate the cursor(to say line 1) before I issue an Whoa there! This sounds like you tried to execute an INPUT ARRAY from inside an INPUT ARRAY block! This is not permitted simply because of the confusion it causes! Move each of thethe inner INPUT ARRAY statements into a separate function and call the function(s) from the outer statement instead. This will create a new stack for the INPUT ARRAY to use. Art S. Kagel
I was calling another function from within the input array. However, that function called the original function that contained the the original input array. By changing it to call a different function with a different input array based on the number of stacked windows, it seems to work. Thanks for your response! Matt "Art S. Kagel" wrote: > Matt Brickley wrote: > > > > On SE 7.23, 4GL 6.04 SCO Unix 5.04: > > I have developed a menu program that is a series of INPUT ARRAY > > statements. > > There are different size windows opened depending on the number of menu > > items > > read from the DB. My problem is this: > > When I close a window where the cursor was say on line 6 of the array > > and the window > > beneath it only has 3 lines, I get a subscript out of bounds error > > because there is no > > line 6 on the preceeding window that now has the active INPUT ARRAY. > > Is there a way to manipulate the cursor(to say line 1) before I issue an > > Whoa there! This sounds like you tried to execute an INPUT ARRAY from > inside an INPUT ARRAY block! This is not permitted simply because of > the confusion it causes! Move each of thethe inner INPUT ARRAY > statements into a separate function and call the function(s) from the > outer statement instead. This will create a new stack for the INPUT > ARRAY to use. > > Art S. Kagel