
Chris Richardson (VP Plc) asked a question.
We have lots of legacy GUI code written in the AppBuilder and PDSOE.
When a minor change to a screen is made, the AppBuilder-generated-code shifts the code for frame definitions all over the place, creating complex merge conflicts when merging into staging branches with Git.
For example, within a frame a few widget widths are changed. The definition for the frame is moved from line 200 to line 450.
Is there anyway to stop the AppBuilder from behaving this way?
To mitigate this we're having to create dependencies on previous branches but this is complex and creates a blocker for getting code into production.
It didn't leave me alone. Finally I found the bug. It's more a typo than a bug.
adeshar/_gendefs.p -> PROCEDURE put-frame-definitions-in relies on the fact that widgets that cannot be tabbed (like text, image, ...) have a u._tab-order of 0. Before writing the code out, adeshar/_gendefs.p calls adeuib/_tabord.p. This procedure assigns the proper value to the widgets _U._tab-order depending on the settings of the Tab Order Dialog: L-to-R|R-to-L][,COLUMNS, custom.
There a two loops to filter QUERY,TEXT,IMAGE,RECTANGLE,LABEL. The first one is correct. The second one had the bug.
Buffer _U used instead of x_U. Just one "x" missing 😁.
Text and others got a value for _tab-order > 0. And the value was unpredictable, because the query sorts by _tab-order which is initialy 0 for text, so the order for widgets with _tab-order = 0 is by recid.
OPEN QUERY t_order
PRESELECT EACH x_U
WHERE x_U._parent-recid = p_Urecid
AND x_U._STATUS eq p_status
AND RECID (x_U) ne p_Urecid
/**** Thomas Wurl, Taste IT Consulting 29.12.2021 - _U was used instead of x_U ****/
/*AND NOT CAN-DO ('QUERY,TEXT,IMAGE,RECTANGLE,LABEL':U, _U._TYPE),*/
AND NOT CAN-DO ('QUERY,TEXT,IMAGE,RECTANGLE,LABEL':U, x_U._TYPE),
EACH x_L
WHERE x_L._u-recid = RECID(x_U)
AND x_L._LO-NAME = "Master Layout":U
AND NOT x_L._NO-FOCUS
BY x_U._TAB-ORDER.
GET FIRST t_order.
DO WHILE AVAILABLE (x_U):
skip_object = FALSE.
IF x_U._TYPE = "FILL-IN":U AND x_U._SUBTYPE = "TEXT":U THEN skip_object = TRUE.
IF NOT skip_object THEN
ASSIGN tab_i = tab_i + 1
x_U._TAB-ORDER = tab_i.
GET NEXT t_order.
END.
So:
Attached is this:
To see the problem:
Then apply the patch: rename xadeuib back to adeuib. Open the viewer again. Check it with FrameDefs.w again.
Now it's fine! The code of _tab-order.p is from 1995. It never worked before! 😂
Happy New Year 2022!
AbFixFinal