Re: Getting last key pressed in 4GL
Posted in 1994
Dirch Scheer (scheer@stadt-mh.de) wrote: : >Date: 14 Jun 1994 08:12:45 GMT : >Hello out there, : >I want to implement the following mechanism with 4GL: : >A database is polled every 3 seconds and some sums are displayed on screen. : >This is programmed in a endless loop. In this loop I check for pressing of : >the INTERRUPT key by checking the value of int_flag. If this button is : >pressed the user will end the endless loop. Everything is working fine. : >But now my question. I want to use other keys to start printing of the : >current shown sums or to switch the display. Till now, I don't have found : >any solution to get the last key pressed by user except the INTERRUPT key. Michel Behna (mbehna@promus.com) wrote: : Look at fgl_lastkey() function. I know it was undocumented and if you need the : info I can dig it up. It returns an int ( I think, I am quoting from memory : and mine is not as good as it used to be :-) ). -- I have tried this hint, but it doesnt work. I have written a short program shown below: -------------------------------------------------------------------------- main defer interrupt let int_flag = 0 while true call show_key( fgl_lastkey() ) if int_flag != 0 then display "Aborted with DeleteChar!!!" exit while end if end while end main function show_key( keyvalue ) define keyvalue integer if keyvalue != 0 then case when keyvalue = fgl_keyval("f1") display "Key F1 pressed..." when keyvalue = fgl_keyval("f2") display "Key F2 pressed..." otherwise display "Key ", keyvalue," pressed..." end case end if end function -------------------------------------------------------------------------- I expected to see messages when pressing any key. But all I get is the abort-message when hitting the DeleteChar. Have I done something wrong??? Are there any other solutions for the problem??? Shall I change the programming language??? :-) Any hints are appreciated... Dirch +----------------------------------------------------------------------------+ | Dirch Scheer email: scheer@stadt-mh.de | | Amt 10-3 Tel. : +49 208 455 1006 | | Stadtverwaltung (snail-)Mail : Ruhrstr. 32 | | Muelheim an der Ruhr D-45468 Muelheim an der Ruhr | |----------------------------------------------------------------------------| | Inspiration gave them the motivation to move on out their isolation | +----------------------------------------------------------------------------+