Re: 4GL INPUT ARRAY: How to ask Delete[Y/N]? before deleting a row
Posted in 1992
Path: emory!europa.asd.contel.com!uunet!halexii!halexv!greg From: greg@halexv.uucp (Gregory F. Hogg) Newsgroups: comp.databases.informix Message-ID: <1992Jan13.132807.1168@halexv.uucp> Date: 13 Jan 92 13:28:07 GMT References: <1992Jan6.153200.15031@cbnews.cb.att.com> <1596@das13.snide.com> Reply-To: greg@halexv.UUCP (Gregory F. Hogg) Organization: HOGG'S SOFTWARE; Abingdon, MD In article <1992Jan6.153200.15031@cbnews.cb.att.com>, mvctm@cbnews.cb.att.com (carl.t.mosley) writes: > During an INPUT ARRAY statement, when the user presses the DELETE key, > I want to ask the user to confirm the delete. > > Has anyone successfully come up with a way to back out of a delete? Here is a code fragment of how I do it. (NOTE: I did not have time to test this but it is based on code that I use all the time) FUNCTION ExampleInputArray(InputArrayNbr) DEFINE InputArrayNbr INTEGER # DEFINE UserEsc INTEGER, ExitInput INTEGER, MemRow INTEGER, GotoRow INTEGER, yesno CHAR(1) # # ----- how many rows in the array ----- # CALL set_count(InputArrayNbr) # # ----- initialize variables ----- # LET int_flag = 0 LET UserEsc = FALSE LET ExitInput = FALSE LET GotoRow = NULL WHILE int_flag == 0 AND UserEsc == FALSE AND ExitInput == FALSE LET MemRow = NULL LET UserEsc = TRUE INPUT ARRAY GInputArray # Global array WITHOUT DEFAULTS FROM ScreenRecord.* # Defined in form BEFORE ROW LET MemRow = arr_curr() # # ----- is this a goto? ----- # ----- NOTE: skiprow is a NOENTRY, NOUPDATE in the form ----- # IF GotoRow > MemRow THEN NEXT FIELD skiprow END IF LET GotoRow = NULL BEFORE DELETE PROMPT "Confirm Delete Row (Y/N) ? " FOR CHAR yesno IF yesno NOT MATCHES "[yY]" THEN ERROR "ROW NOT DELETED" LET UserEsc = FALSE LET GotoRow = MemRow EXIT INPUT END IF END INPUT # # ----- did the user abort? ----- # IF int_flag != 0 THEN ERROR "ABORT!" RETURN END IF END WHILE END FUNCTION -- +++++++++++++++++ +++++++++++++++++++ Greg Hogg +++ +++