Bug #12073
no warning 4070 when FRAME HEIGHT-CHARS is set below the height its widgets need
0%
History
#1 Updated by Sergey Ivanovskiy 12 days ago
- File height-chars-4070.p
added - File openedge-warning-4070.png added
- File openedge-message-after.png added
- File fwd-no-warning.png added
GUI: no warning 4070 when FRAME HEIGHT-CHARS is set below the height its widgets need¶
Summary¶
In the GUI, setting HEIGHT-CHARS of a frame that is already shown to a value below the height its visible widgets need is rejected by OpenEdge with warning 4070, and the frame keeps showing all its widgets. FWD shows no warning and shrinks the frame, so the widgets below the new height disappear.
The client-side check that should raise the warning exists (Frame.canSetHeightChars), but two of its conditions are false in this case: the frame's minimum height is computed without its widgets, and the frame config's wasRealized flag is not set on the client although the frame was shown.
Reproducer¶
The attached height-chars-4070.p shows a frame with three fields on three rows in the default window, sets its HEIGHT-CHARS to 1, and reports the height before and after (in an alert box and in height-chars-4070.log). SESSION:SYSTEM-ALERT-BOXES is set so that the warning goes to an alert box regardless of the window's message area.
DEFINE VARIABLE cA AS CHARACTER NO-UNDO LABEL "A" FORMAT "x(8)" INITIAL "first". DEFINE VARIABLE cB AS CHARACTER NO-UNDO LABEL "B" FORMAT "x(8)" INITIAL "second". DEFINE VARIABLE cC AS CHARACTER NO-UNDO LABEL "C" FORMAT "x(8)" INITIAL "third". DEFINE VARIABLE dBefore AS DECIMAL NO-UNDO. DEFINE VARIABLE dAfter AS DECIMAL NO-UNDO. DEFINE FRAME fInfo cA SKIP cB SKIP cC WITH SIDE-LABELS THREE-D. /* warnings and errors go to an alert box, independent of the message area */ SESSION:SYSTEM-ALERT-BOXES = yes. DISPLAY cA cB cC WITH FRAME fInfo. dBefore = FRAME fInfo:HEIGHT-CHARS. FRAME fInfo:HEIGHT-CHARS = 1. dAfter = FRAME fInfo:HEIGHT-CHARS. OUTPUT TO "height-chars-4070.log". PUT UNFORMATTED "HEIGHT-CHARS before: " STRING(dBefore) " after: " STRING(dAfter) SKIP. OUTPUT CLOSE. MESSAGE "HEIGHT-CHARS before:" dBefore "after:" dAfter VIEW-AS ALERT-BOX.
Expected result (OpenEdge)¶
Tested with OpenEdge 11.6 GUI (prowin):
- The assignment
FRAME fInfo:HEIGHT-CHARS = 1opens a "Warning" alert box:**Unable to set the HEIGHT of the FRAME fInfo too small to contain all visible widgets. (4070)(attachmentopenedge-warning-4070.png). - After OK, the "Message" box shows
HEIGHT-CHARS before: 3.1 after: 1, and the log file has the same values. - The frame still shows all three fields A, B and C (attachment
openedge-message-after.png).
So OpenEdge warns and keeps the frame's visible size, although the attribute reads back as 1 afterwards.
Actual result (FWD)¶
Tested with the FWD web GUI client, trunk revision 16809:
- No "Warning" box appears. The program goes straight to the "Message" box with
HEIGHT-CHARS before: 3.1 after: 1; the log file has the same values. - The frame is shrunk to one row: only "A: first" is visible, B and C are gone (attachment
fwd-no-warning.png).
The test fails on two points: warning 4070 is missing, and the frame is resized below the space its widgets need.
Why the test fails in FWD¶
FWD has no server-side check for 4070; FrameWidget only has a TODO comment for it. The check runs on the client when the attribute change reaches it, in Frame.canSetHeightChars(double, boolean) (ui/client/Frame.java). It raises 4070 only if all of these hold:
- the frame is in a configuration update with a size change (
sizeErrorCondition()); - the new height is below
getMinimumSize().height; - the frame is not scrollable (or the virtual height is set);
isRealized()andconfig.wasRealizedare both true.
A temporary log line at the start of canSetHeightChars showed these values for fInfo when the new height arrived:
height=1.0 configUpdateActive=true sizeChanged=true scrollable=false realized=true minHeight=0.2 wasRealized=false
Two conditions are false:
- The minimum height ignores the widgets.
Frame.getMinimumSize()takes the width from the content pane's effective scrollable size, but the height fromgetFixedHeight(), which for this side-labels frame is only the border (0.2). The three fields need about three rows, so 1 should be too small, but compared with 0.2 it is accepted. wasRealizedis false on the client. The frame was displayed before the assignment (realized=true), but the client's frame config still haswasRealized=falsewhen the new height arrives, so the 4070 branch would be skipped even with a correct minimum height. The flag is set on the server (GenericWidget) and in client widget code (AbstractWidget,FrameGuiImpl); why it is not set on the client config in this flow has not been traced yet.
Because the check returns true, the client applies the height and the frame shrinks.
Suggested direction¶
- Compute the minimum frame height from the widgets that must stay visible, the same way the width is computed, instead of from
getFixedHeight()only. - Make sure the client frame config has
wasRealizedset once the frame has been shown (or find why it is reset), so that the 4070 branch is reachable. - Keep the frame's visible size when 4070 is raised, as OpenEdge does. Check against OpenEdge which value
HEIGHT-CHARSshould return afterwards: OpenEdge 11.6 returns the new value (1) in this test. - Check whether
VIRTUAL-HEIGHT-CHARS, the pixel height attributes and the width counterpart (WIDTH-CHARS) have the same gap;canSetHeightCharsalso handles the virtual height.
Other difference seen with the reproducer¶
Not part of this issue: the MESSAGE statement with several expressions shows HEIGHT-CHARS before: 3.1 after: 1 on OpenEdge but HEIGHT-CHARS before:3.1after:1 on FWD (no spaces between the items).
Attachments¶
height-chars-4070.p: the reproducer.openedge-warning-4070.png: OpenEdge 11.6, the 4070 warning box.openedge-message-after.png: OpenEdge 11.6 after the warning, all three fields still visible.fwd-no-warning.png: FWD, no warning, the frame reduced to one row.