Re: Informix Ring Menu - Before Menu Option
Posted in 1996
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
In article <50q88n$hs1@cssun.mathcs.emory.edu>, Ken McCoy <KENM@apscn.k12.ar.us> wrote: >Hello again everyone, > >Hopefully there is something I'm overlooking here (code follows). > >Here is the problem . . . > 1.) You have a great 4gl menu with a Next and an Update option on. > 2.) A user hits the Next option until the last record in the set is > reached . The user selects the Delete option from the menu and > deletes the last record. > 3.) Everything is cool at this point. On the delete, we try to get the > next record. We check the status. We know we are at the last record. > So, we clear the form and pop up a message telling the user that there > are no more records to be found. > > 4.) THE PROBLEM: The update and Delete options still display on the > Menu. If the user chooses these options it will try to execute > the code associated with these options and generate Nasty error > messages. > > Is there any way, besides hardcoding flags or status variables, to > either: > 1.) re-execute the BEFORE MENU section of the MENU? > Which in this case would HIDE all options except > for "Query","Build","Options","Exit" > 2.) Disable or Hide the options some other way? I may be misunderstanding your problem, but wouldn't the following pseudo-code get to the problem you're having: MENU BEFORE MENU ... SHOW OPTION "Update" SHOW OPTION "Delete" SHOW OPTION "Next" SHOW OPTION "Previous" COMMAND "Next" CALL get_next_row() RETURNING get_record_status IF (get_record_status != 0) THEN IF (get_record_status = NOTFOUND) THEN ERROR "No next record" HIDE OPTION "Next" ELSE CALL bomb_out() END IF # If there was no next record to get ELSE # We got the next record just fine SHOW OPTION "Update" SHOW OPTION "Delete" SHOW OPTION "Next" SHOW OPTION "Previous" END IF # If there was no next record to get COMMAND "Previous" CALL get_prev_row() RETURNING get_record_status IF (get_record_status != 0) THEN IF (get_record_status = NOTFOUND) THEN ERROR "No previous record" HIDE OPTION "Previous" ELSE CALL bomb_out() END IF # If there was no next record to get ELSE # We got the next record just fine SHOW OPTION "Update" SHOW OPTION "Delete" SHOW OPTION "Next" SHOW OPTION "Previous" END IF # If there was no next record to get COMMAND "Delete" CALL delete_current_record() RETURNING get_record_status IF (get_record_status != 0) THEN IF (get_record_status = NOTFOUND) THEN # No next record HIDE OPTION "Next" HIDE OPTION "Delete" HIDE OPTION "Update" ELSE CALL bomb_out() END IF # If there was no next record to get END IF # If there was a problem getting the next record COMMAND "Update" ... END MENU I hope that helps. >Any and all ideas are welcome. > >TIA.. > >Ken McCoy