Ignore:
Timestamp:
02/19/20 10:44:38 (4 years ago)
Author:
bnemhaus
Message:

Frame::Parse has been updated to include a new boolean parameter. When true, widgets that are created as a result of the parse send not only notify the widget framework that they have been added, but are also visible. When false, they only notify they have been added.

The widget framework now distinguishes between added and visible widgets, this fixes a bug. Bug: when programmatically adding a widget to not the current frame, it never gets properly removed and therefore still catches click events from users. By distinguishing between adding and making visible this is avoided.


Another bug has been fixed. Bug: When setting a text item to have a right anchor, and then subsequently reducing the size of the window, this text item would get a width of zero assigned. This was caused by some issues with the logic of how right margins for items were calculated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Item.java

    r1509 r1511  
    27402740        }
    27412741
    2742         public void setRightMargin(int i, boolean fixWidth)
    2743         {
    2744                 int newWidth = i - getX() - Item.MARGIN_LEFT;
    2745                 if (newWidth < 0) newWidth = 0;
    2746                
    2747                 if (!fixWidth) {
    2748                         newWidth *= -1;
    2749                 }
    2750 
    2751                 setWidth(newWidth);
     2742        public void setRightMargin(int rightEdgeToFitTo, boolean fixWidth)
     2743        {
     2744                int itemXLeft = getX();
     2745                int adjustedRightEdgeToFitTo = rightEdgeToFitTo - Item.MARGIN_LEFT;
     2746               
     2747                if (itemXLeft < adjustedRightEdgeToFitTo) {
     2748                        int newWidth = adjustedRightEdgeToFitTo - itemXLeft;
     2749
     2750                        if (!fixWidth) {
     2751                                newWidth *= -1;
     2752                        }
     2753
     2754                        setWidth(newWidth);
     2755                } else if (fixWidth) {
     2756                        System.err.println(
     2757                                        "Item::setRightMargin() called to set right margin outside of writable area but with fixWidth set to true.");
     2758                        System.err.println(this);
     2759                }
    27522760        }
    27532761
     
    36553663                if (anchor != null) {
    36563664                        anchorConstraints();
    3657                         setX(DisplayController.getFramePaintArea().getMaxX() - anchor - getBoundsWidth());
     3665                        int width = Math.abs(getBoundsWidth());
     3666                        //System.err.println("Item::setAnchorRight::Text Content= " + getText() + "; width=" + width);
     3667                        setX(DisplayController.getFramePaintArea().getMaxX() - anchor - width);
    36583668                }
    36593669               
Note: See TracChangeset for help on using the changeset viewer.