Re: Multiple screen forms in 4GL..forget last posting!
Posted in 1997
Wookie To do what you require is kind of defeating the object of 4gl. It is meant to be an improvement over the limitations of using SQL forms. Your choices are: 1) Provide users access to additional screens using a set of function keys. These screens could be accessible at any time by pressing the appropriate key and the user is always taken back to the main screen after they finish the child form by pressing the same Fkey (if you need it that way), or just by pressing ACCEPT. They do then need to press ACCEPT on the parent form. If you use borders to clearly show one form overlaying another, the users should soon be able to get the idea of it. 2) Use a while loop around each of your input statements and set the after field action in the INPUT up so that the user exits input after the last field (OPTIONS INPUT NOWRAP). Define an accept key that the user is never likely to press and use an on key statement to handle the real accept key, setting a flag to indicate that you want to exit. Skeleton code: While not accepted and not int_flag input ..... on key(F1) -- Accept key let accepted = true exit input end input if not accepted and not int_flag input statement 2 end if -- Validations to make sure all required info completed -- This is necessary to ensure that REQUIRED data -- from secondary screens has been provided. End While If you want to make it even more obtuse, use a case statement and a counter to indicate which input statement to deal with. This is harder to read, but makes for more flexible handling of validation. You can make this as complicated as you like, even to the extent of determining the field that the cursor starts off in, assuming you have a version of 4GL that supports BEFORE INPUT. Let screen_no = 1 While not accepted and not int_flag case when screen_no = 1 input ..... on key(F1) -- Accept key let accepted = true exit input end input when screen_no = 2 input statement 2 end case if accepted then -- Validations to make sure all required info completed -- This is necessary to ensure that REQUIRED data -- from secondary screens has been provided. if validation fails then -- Set screen number to the one resonsible for -- missing data, or take user to first screen. end if else let screen_no = screen_no + 1 if screen_no > max_screen then let screen_no = 1 end if end if End While For what its worth, I generally prefer option 1 and giving the users some retraining. Over time the code will be cleaner and easier to maintain. I wouldn't mind betting that once they get used to it, most of the users will prefer the new method. Thats been my experience anyway. Mark MarkDenham@aol.com (home) Denham.M@amstr.com (work)