ON KEY in CONSTRUCT
Posted in 1993
I've just found a weird behaviour of the CONSTRUCT statement. I tried to use ON KEY in order to call a help function and modify the input buffer with DISPLAY. (That's exactly what the manual suggests to do) But ... a) if the called function has an INPUT statement, the DISPLAY shows the new value and it is inmediately cleared! (and the buffer is empty again) b) if the called function has no INPUT statements, it works fine: DISPLAY shows the value and it IS in the buffer. c) if the function has no input statement, but it's called AFTER a function with input, it works like a) instead of b) d) everything works ok if I compile it with c4gl instead of generating p-code with fglpc Ideas ? Magic solutions ? Any wizard out there ? Thanks for your time. ale. -------------------------------------------------------------------------- Here's a piece of code you can test: MAIN DEFINE qstr CHAR(512), pfunc CHAR(8) OPEN WINDOW w1 AT 3, 2 WITH FORM "tt" INITIALIZE qstr, pfunc TO NULL CONSTRUCT BY NAME qstr ON f.codigo ON KEY(CONTROL-W) CALL func_with_input() RETURNING pfunc DISPLAY pfunc TO codigo ON KEY(CONTROL-F) CALL func_no_input() RETURNING pfunc DISPLAY pfunc TO codigo END CONSTRUCT CLOSE WINDOW w1 DISPLAY qstr END MAIN FUNCTION func_with_input() DEFINE mascara CHAR(8) INITIALIZE mascara TO NULL OPEN WINDOW cod2 AT 10, 10 WITH FORM "codi2" ATTRIBUTE(BORDER) INPUT mascara FROM a0 CLOSE WINDOW cod2 RETURN mascara END FUNCTION FUNCTION func_no_input() DEFINE mascara CHAR(8) INITIALIZE mascara TO NULL OPEN WINDOW cod2 AT 10, 10 WITH FORM "codi2" ATTRIBUTE(BORDER) CLOSE WINDOW cod2 LET mascara = "DIS*" RETURN mascara END FUNCTION ----------------------------------------------------------------------- Maria Alejandra Perez Weiss alex@lucas.mrec.ar PNUD - Min. Rel. Exteriores alex%lucas.mrec.ar@uunet.uu.net Buenos Aires - Argentina ...!uunet!atina!lucas!alex