Re: Timed input, and input array on a certain line in 4gl.
Posted in 1992
In article <3949@wet.UUCP> dror@wet.UUCP (dror matalon) writes: > Does anybody know how to do you do the following in 4gl? > > 1. Do an input/input array statement and if the user hasen't typed anything > within a certain length of time return control to the program. This > would be usefull when you want to display information as it is updated > in the database and still accept user input? (tbmonitor profile screen > could use this feature). The simplest solution is to let the user do the timing for you, by pressing a key when she wants a fresh display. After all, there's no point in generating an updated display when nobody is looking, right? So just put a note on the screen, "press ^D to refresh display" and set up an ON KEY for that key. In it, EXIT INPUT after setting a flag that will cause you to refresh the display and immediately return to input mode -- using the trick that harry bochner posted to get back to the original row. The only drawback to this is, the user has no way of knowing when hitting ^D will actually show any new info. So long as the user is interacting in some fashion you can do this: you put CALL POLL_NEW_INFO() in every single BEFORE/AFTER/ON KEY block you have. In that function you check for new info and use DISPLAY to mark the screen if there is any. Since 4GL isn't multi-threading, there's no way to do this polling when in INPUT and the user isn't hitting keys (that I can think of).