Bug #2139
Frames scoped to a subroutine is reused for subsequent calls
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/30/2013
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
version:
History
#1 Updated by Ovidiu Maxiniuc about 11 years ago
- Subject changed from Frame is destroyed when subroutine ends to Frames scoped to a subroutine is reused for subsequent calls
In 4GL, a scoped frame to a function / procedure is kept on screen even after the subroutine returns and a new frame is created each time the subroutine is called.
function f returns logical (p as int): define variable xx as char. xx = string(p). display xx SKIP WITH NO-LABEL NO-BOX. end. f(1). f(2). f(3).
Here is the output on 4GL:
1 2 3
In P2J, the output frame is reused on and on, and because the height of the frame is 1, only the output of the last run is visible:
3
Altering the code this way:
def var h as handle. function f returns logical (p as int): define variable xx as char. xx = string(p). display xx SKIP with no-box no-label. h = xx:handle. h = h:frame. message h. end.
in 4GL you will get a new frame handle for each invocation while in P2J you will always get the same frame handle.