Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to detect the Overflow of a Layout?

    Hello everyone,

    I got a pretty basic question, but I could not find any solution using Google, the Forum and the Documentation of Smart GWT.
    I am working with the Smart GWT Version “6.0p”.

    Let's say I create a VLayout with a height and width of 200 x 200 px. It's Overflow is set to “Visible” (which is default).
    Now if there is content added to the VLayout, that is bigger then the Layout itself, the Layout will expand its Size based on the Content added.

    My Question is:
    Is there a way to check if the Layout has expanded its own size / has an overflow?

    Something like “Layout.hasOverflow()”, so I could set a different border to the Layout, if it has expanded its size?

    I already searched the Documentation of Layout, HLayout, VLayout and even Canvas without finding something like this.

    Also, i tried to compare the height and width of the Layout before and after adding the content.
    Therefore, i tried the following commands:
    layout.getInnerContentWidth()
    layout.getDefaultWidth()
    layout.getMinWidth()
    layout.getWidth()
    layout.getVisibleWidth()

    But the Values where the same before and after adding content.

    Thank you in advance!
    ~Jay

    #2
    Compare getWidth() to getVisibleWidth(). If you tried this and it didn't seem to work, most likely the component was not drawn. If the component is not drawn, we don't know if it's going to overflow or not. See the docs for layout.addMember() - it explicitly mentions this use case, and reminds you to call reflowNow() if you need the size of a newly added member.

    Comment


      #3
      Hello Isomorphic,

      The "reflowNow()" seems to has done the trick for me. Now Width and VisibleWidth got different Values. Also knowing that the View needs to be drawn first is a usefull input for future use.

      Thank you for the Quick response!

      Kind Regards
      ~Jay

      Comment

      Working...
      X