Announcement

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

    Bug: vertical scroll for mouseOver on the last tile in a TileGrid

    I have a TileGrid with several tiles such that the vertical scroll appear. If I scroll at the bottom and move the mouse over the last tile then the grid scrolls up and it shouldn't. Attached is the test case.
    Attached Files

    #2
    Firstly, please be sure to check the console before posting - the odd scrolling you reported is due to this warning in the log:

    Code:
    TileGrid does not support layoutPolicy 'flow'; there may be unexpected behavior.  Use a TileLayout instead for flow layout.
    Get rid of the layoutPolicy setting to fix the scroll misbehavior.

    Secondly, please see the advice we offered in your other thread here. You are using createTile() to return an instance of SimpleTile with completely custom content, but falling foul of it's builtin rollover behaviors.

    Instead, If you want a custom tile, use the autoChild system - set tileConstructor to a Canvas or Layout, and use tileProperties to provide your custom content and rollover behavior.

    Comment


      #3
      Firstly, that message appears because I am using
      Code:
      setLayoutPolicy(TileLayoutPolicy.FLOW);
      Hence I guess the method is installing a TileLayout... so I do not know why the warning appears.

      Secondly, even if I use
      Code:
      setLayoutPolicy(TileLayoutPolicy.FIT);
      or if I comment the line the warning disappears but the bug is still present, hence the problem does not come from the layout.

      And finally this has nothing to do with that thread since in this test case I am not doing any rollover actions. I am just using a very simple custom tile that extend the SimpleTile class and a scrolling bug appears.

      Comment


        #4
        Your code creates a TIleGrid - it's not clear why you would think that setting a layoutPolicy would cause a TileLayout to be created instead, but it won't. That setting is just invalid, as the log says, and should be removed.

        On using SimpleTile, yes, we understand what you're doing - and that's why we advised you to do it a different way. SimpleTiles have builtin custom behavior - just overriding getInnerHTML() to provide "" and providing completely custom widgets as content doesn't stop those behaviors. You're SimpleTile subclasses also set overflow to visible, and that's problematic too for SimpleTile.

        Just don't use SimpleTile, or use a TileLayout instead.
        Last edited by Isomorphic; 2nd Apr 2020, 01:18.

        Comment


          #5
          Originally posted by Isomorphic View Post
          Your code creates a TIleGrid - it's not clear why you would think that setting a layoutPolicy would cause a TileLayout to be created instead, but it won't. That setting is just invalid, as the log says, and should be removed.
          Pure and simple because of what the API says :) I did not set any layout as I expected the TileGrid to have its own layout. I do not care what layout it uses internally. I just set the layout policy.

          Originally posted by Isomorphic View Post
          On using SimpleTile, yes, we understand what you're doing - and that's why we advised you to do it a different way. SimpleTiles have builtin custom behavior - just overriding getInnerHTML() to provide "" and providing completely custom widgets as content doesn't stop those behaviors. You're SimpleTile subclasses also set overflow to visible, and that's problematic too for SimpleTile.

          Just don't use SimpleTile, or use a TileLayout instead.
          The overflow property on the tile seems to generate the scrolling bug. But the combination of TileLayoutPolicy.FLOW for tile grid with setOverflow(Overflow.VISIBLE) for tile was the only possibility to make the tiles expand horizontally for the entire width of the tile grid. This is what I wanted to achieve and it works just fine except the scrolling bug...

          Regarding using SimpleTile: we are extending it because of the selection and the mouse over styling functionality. Why write code from scratch when you can reuse? Hence can we extend SimpleTile class to achieve all the above?

          Comment


            #6
            There is of course no need to 'write code from scratch' - but this back and forth is not constructive.

            So, if you want to stay on your current trajectory:

            - in your TestTile class, remove setWidth/Height/Overflow() calls
            - in your TileGrid, remove setWidth(250) and instead setTileWidth(250) and setOverflow(Overflow.VISIBLE)

            Comment


              #7
              To clarify, since the TileGrid supports load on demand, it needs to know the overflow size that all tiles will take up, in advance, before tile content is loaded. So it needs a uniform size for tiles.

              Your settings are asking for tile sizes to be dynamically determined and that's not supportable with load on demand. If you don't need load on demand but you do need dynamic sizes, you can use the superclass, TileLayout, and generate your own tiles, and they can be variable size, and flow layout is supported.

              Comment


                #8
                Your above settings solve the problem but make the tiles have fixed height and we want dynamic height. That is why I set tile height of 1 and overflow visible. But this overflow visible seems to break the scrolling behavior of the tile grid (and we also want scrolling to the tile grid).

                I do not even know if we need load on demand... but we do need dynamic height for tiles. It is not clear what you mean by "you can use the superclass, TileLayout, and generate your own tiles".

                Comment


                  #9
                  OK, so finally we get to the crux of it. Yes, TileGrid is designed for load on demand. If you don't need load on demand, and you do need mismatched tile sizes, then fetch all the data in advance using DataSource.fetchData() directly, create tiles yourself (you can use any Canvas subclass you want), and add them to the TileLayout via simply calling addTile().

                  Comment

                  Working...
                  X