Project

General

Profile

Bug #2781

Bug #2677: fix drawing and functional differences between P2J GUI and 4GL GUI

./button/gui_btn_test4.p the vertical scrollbar appears if the "Fill on/off" is pressed

Added by Sergey Ivanovskiy over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
10/23/2015
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

gui_btn_test4.png (72 KB) Sergey Ivanovskiy, 10/23/2015 12:55 PM

gui_btn_test4_4gl.jpg - Gui btn test4 4gl (61.5 KB) Eugenie Lyzenko, 10/28/2015 05:38 PM

gui_btn_test4_p2j_20151027_10974.jpg - Gui button test 4 P2j revision 10974 (84.9 KB) Eugenie Lyzenko, 10/28/2015 05:38 PM

gui_btn_test4_p2j_20151028_10975.jpg - Gui button test 4 P2j revision 10975 (124 KB) Eugenie Lyzenko, 10/28/2015 05:38 PM

gui_btn_test4_p2j_20151029.jpg - Fixed unwanted scrollbar issue (34.5 KB) Eugenie Lyzenko, 10/29/2015 03:49 PM

gui_btn_test4_p2j_fixed_layout_20151029.jpg - FIxed buttons layout (65 KB) Eugenie Lyzenko, 10/29/2015 10:38 PM

bottom_frame_border_wrong_painting_p2j_20151031.jpg - Frame border issue (30.5 KB) Eugenie Lyzenko, 10/31/2015 05:10 PM

gui_btn_test4_p2j_fixed_layout_20151102.jpg - Fixed bottom frame border painting (74.7 KB) Eugenie Lyzenko, 11/02/2015 11:01 AM

gui_btn_test4_p2j_regression_with_11001_20151102.jpg - Layout issue came back (43.5 KB) Eugenie Lyzenko, 11/02/2015 03:02 PM

History

#1 Updated by Sergey Ivanovskiy over 8 years ago

The detailed look and feel is described by the attached picture.

#2 Updated by Greg Shah over 8 years ago

  • Assignee set to Eugenie Lyzenko
  • Target version set to Milestone 12

#3 Updated by Eugenie Lyzenko over 8 years ago

Initial investigations for issue. The 4gl initial picture is attached here.

1. Take a look at the p2j 10974 and 10975 versions pictures. The frame loses the centered position and I think it is the regression from 10975.

Constantin, can you tell what can be the reason, what was changed in Frame with 10975 that causes the frame centering to become off?

2. The issue is the button widgets are not properly positioned by automatic layout manager as you can see comparing to 4gl picture.

3. There is a good news too. In 10975 the scrollbar is not drawing anymore. I think this was a kind of frame size or scrollpane inside frame size issue.

Continue working.

#4 Updated by Constantin Asofiei over 8 years ago

Eugenie Lyzenko wrote:

Initial investigations for issue. The 4gl initial picture is attached here.

1. Take a look at the p2j 10974 and 10975 versions pictures. The frame loses the centered position and I think it is the regression from 10975.

Constantin, can you tell what can be the reason, what was changed in Frame with 10975 that causes the frame centering to become off?

The problem was related to the fact that the window doesn't adjust its virtual dimension when its width/height is set via the attributes (and the window is not yet realized). See 2677a rev 10980 for the fix.

There is still an issue here: if the window's size is adjusted (smaller) AFTER it is realized, then scrollbars are not displayed for the workspace.

2. The issue is the button widgets are not properly positioned by automatic layout manager as you can see comparing to 4gl picture.

The layout call which miss-places the buttons is this in FrameGuiImpl:

   public void setVisible(boolean visible)
   {
      if (visible && !config().realized)
      {
         savedTabOrder = null;

         // remove all labels (they we'll be re-added by the layout)
         Widget<GuiOutputManager>[] widgets = getContentPane().widgets();
         for (Widget<GuiOutputManager> widget : widgets)
         {
            if (widget instanceof Label)
            {
               widget.destroy();
               screen().getRegistry().removeWidget(UiUtils.getWidgetId(widget));
            }
         }

         doLayout();

         config().realized = true;
      }

This code needs to remain, as final layout is decided on frame realization. But please investigate why the buttons are miss-placed - maybe something else needs to be reset?

3. There is a good news too. In 10975 the scrollbar is not drawing anymore. I think this was a kind of frame size or scrollpane inside frame size issue.

I'm still seeing the scrollbar with rev 10980.

#5 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10983.

This is the fix for unwanted scrollbar for this issue and for 2782 movie-ratings-dynamic.p has scroll bars but 4GL window hasn't as well. The change is related to frame title height value calculation. The current screenshot is attached.

So the remaining issue is incorrect button placement inside the frame. Should I investigate and fix it within this task?

#6 Updated by Constantin Asofiei over 8 years ago

Eugenie Lyzenko wrote:

So the remaining issue is incorrect button placement inside the frame. Should I investigate and fix it within this task?

Yes, please do.

#7 Updated by Eugenie Lyzenko over 8 years ago

Hynek,

Debugging widget layout issue I have found the following weird code in StackLayout, method doLayout line 125:

...
      if (direction == Direction.VERTICAL)
      {
         maxSize = container.width() - insets.left - insets.right;
      }
      else
      {
         maxSize = container.width() - insets.left - insets.right;      
      }
...

I think the correct code is:
...
      if (direction == Direction.VERTICAL)
      {
         maxSize = container.width() - insets.left - insets.right;
      }
      else
      {
         maxSize = container.height() - insets.top - insets.bottom;      
      }
...
         if (direction == Direction.VERTICAL)
         {
            // only containers can be assigned size externally
            if (w instanceof Container)
            {
               ((Container<O>) w).setSize(maxSize, ((Container<O>) w).height());
            }

            origin.y += w.height();
         }
         else
         {
            // only containers can be assigned size externally
            if (w instanceof Container)
            {
               ((Container<O>) w).setSize(((Container<O>) w).width(), maxSize);
            }

            origin.x += w.width();
         }
...

Please confirm if the changed code is correct or explain what original version does. Hopefully currently we always have direction == Direction.VERTICAL so potential bug has no affect for now.

#8 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10984.

The fix for incorrect buttons location. The root cause was improper Z-order restoration in Frame. Simple sequential move widgets to the top does not work if there is non-focusable widget like rectangle in a frame. The screen is attached here.

Careful look at the test shows the following remaining issues:
1. Frame title height is still wrong, it is smaller than expected.
2. Frame and internal area height are incorrect too.
3. The rectangle size is also not exactly match the 4gl version.

#9 Updated by Hynek Cihlar over 8 years ago

Eugenie Lyzenko wrote:

Hynek,

Debugging widget layout issue I have found the following weird code in StackLayout, method doLayout line 125:
[...]

Good catch.

I think the correct code is:
[...]

Yes this is correct.

#10 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10986.

Small fix for StackLayout bug.

#11 Updated by Greg Shah over 8 years ago

Code Review Task Branch 2677a Revision 10984

It looks good.

#12 Updated by Greg Shah over 8 years ago

Careful look at the test shows the following remaining issues:

I see two other issues to add:

4. The bottom border of the frame is not drawn (this is probably just a side-effect of the size problem).
5. Isn't the "Press space bar to continue." message supposed to be cleared from the status area after you press space?

Constantin: Could the size issues be related to some font difference? I do have all the metrics captured and in the jar as expected. I see the same results as Eugenie.

#13 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10988.

This is the fixes for rectangle wrong size and painting for the rounded one.

#14 Updated by Greg Shah over 8 years ago

Code Review Task Branch 2677a Revision 10988

The changes are good. I like the useful comments you added.

#15 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10991.

This is the frame title height fix. When we have the title in a frame - the using of the frame border is mandatory. The frame title is now has the correct height.

Unfortunately the fix causes the regression in issue #2782 movie-ratings-dynamic.p has scroll bars but 4GL window hasn't. Continue working on resolution. The reason can be more difficult to find than I have expected. There can be the dynamic layout and frame size calculation issue in 2782. Continue working.

#16 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10994.

This is the fix for regression in #2782.

The real issue here is the testcase itself. The button on the bottom is placing manually outside the frame virtual size. This is not intentionally because the new row for widget is set to frame:height-chars - 1. This looks good but in GUI the height of the button is not always 1. So p2j turn on the scrollbars. In 4gl this case is ignoring, the coordinate is not changed if part of the widget become outside the frame. So respective checking was added to the widget's server part location setter in BaseEntity.

#17 Updated by Greg Shah over 8 years ago

Code Review Task Branch 2677a Revision 10991/10994

I'm OK with the changes.

#18 Updated by Constantin Asofiei over 8 years ago

Greg Shah wrote:

4. The bottom border of the frame is not drawn (this is probably just a side-effect of the size problem).

Constantin: Could the size issues be related to some font difference? I do have all the metrics captured and in the jar as expected. I see the same results as Eugenie.

Eugenie, is this still an issue? In 2677a there are some changes done previously to WindowLayout in which if the window is resized via attributes, the new size is set for the workspace; and the window's size must include the decorations, too.

I doubt is related to a font difference.

#19 Updated by Eugenie Lyzenko over 8 years ago

Eugenie, is this still an issue?

Yes, still wrong painting. See the picture attached.

This is not a Window issue. The affected widget is a Frame and when the size is calculated dynamically based on the frame content. I think we incorrectly calculate the size of visible part for the ScrollPaneGuiImpl or containers inside while doing the frame layout. This is something like one pixel error may be coming from the fact the coord is 0 based value while size is 1 based value. Or rounding error from char<->pixel transformations. And this is happening when the frame is first showing. Further repainting can dismiss this issue. I think I need to carefully debug Frame.doLayout() code or viewport adjusting that is performing before every frame draw.

#20 Updated by Constantin Asofiei over 8 years ago

Eugenie Lyzenko wrote:

Eugenie, is this still an issue?

Yes, still wrong painting. See the picture attached.

This is not a Window issue. The affected widget is a Frame and when the size is calculated dynamically based on the frame content. I think we incorrectly calculate the size of visible part for the ScrollPaneGuiImpl or containers inside while doing the frame layout. This is something like one pixel error may be coming from the fact the coord is 0 based value while size is 1 based value. Or rounding error from char<->pixel transformations. And this is happening when the frame is first showing. Further repainting can dismiss this issue. I think I need to carefully debug Frame.doLayout() code or viewport adjusting that is performing before every frame draw.

Are the width/height-chars/pixels attributes for frame and widgets computed correct in P2J? Does it happen if the frame contains i.e. a fill-in instead of button/rectangle?

#21 Updated by Eugenie Lyzenko over 8 years ago

Task branch 2677a for review updated to revision 10999.

This is the fix for bottom frame border issue. The scrollpane size should be adjusted early enough to take into account the frame title height.

#22 Updated by Eugenie Lyzenko over 8 years ago

Constantin,

The changes with 11000, 11001 causes the regression that bring me to the original issue(see the attached picture). The other related test(from 2782 - movie-ratings-dynamic.p) is also now broken even with more messed picture.

I know you have made the Z-ordering change that moves the widget in TAB order differently comparing to one defined in 4gl source. Our layout management(ZeroColumnLayout for example) is completely dependent on the widget Z-order. If Z-order is changing - the frame content is changing as well. As you can see in the picture the button coordinates are calculated to be placed after the rectangle because now it is always on the bottom(before buttons in widgets array).

Is you Z-order change really necessary? Because in this case we need to significantly rework the layout manager. Or may be we need another array to hold the required changed widget Z-order?

Which way you planned to go from this point to support both your change and originally defined Z-order?

#23 Updated by Greg Shah over 8 years ago

Code Review Task Branch 2677a Revision 10999

I'm fine with the changes.

#24 Updated by Greg Shah over 8 years ago

Task branch 2677a rev 11003 resolves the regression in this program. My testing shows everything is working properly now (except for a button highlight issue, for which I will open a separate issue).

Eugenie: do you agree that I can close this task?

#25 Updated by Eugenie Lyzenko over 8 years ago

Greg Shah wrote:

Task branch 2677a rev 11003 resolves the regression in this program. My testing shows everything is working properly now (except for a button highlight issue, for which I will open a separate issue).

Eugenie: do you agree that I can close this task?

Yes, I do. The original issue has been fixed.

#26 Updated by Greg Shah over 8 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

#27 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 12 to GUI Support for a Complex ADM2 App

Also available in: Atom PDF