Announcement

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

    Support for getRollOverCanvas functionality for the TileGrid?

    I was not able to find for TileGrid a functionality similar to getRollOverCanvas from ListGrid. Does anyone know how this could be achieved? Or someone from Isomorphic can say if this feature might be included for a future version?

    #2
    See TileGrid.getCurrentTile().

    Comment


      #3
      Maybe I am missing something but the method is never called... Attached is a sample test case.
      Attached Files

      Comment


        #4
        It's not an override point, it's what you call to find out which tile the mouse is over.

        Comment


          #5
          Ok... In this case I suppose that this method should be used within a MouseOverHandler over the TileGrid. But it seems buggy as it is not always returning the tile under the mouse. Please see attached updated TestCase.

          Second issue is that the method always returns null if I use a tile customizer. To reproduce this problem just unckeck the lines 219-225 and you will see that nothing is displayed anymore within the log console.

          Using v12.0p_2020-02-08/LGPL Development Only (built 2020-02-08)
          Attached Files

          Comment


            #6
            Your test case mixes GWT and SmartGWT widgets - see the FAQ, don't do this. Let us know if you can reproduce flaky events without introducing GWT widgets.

            As far as the tile customizer, if you are creating your own tiles then we cannot install our standard functionality. But in that case, you can simply add a MouseOver event to your custom tile, so it's trivial to find out the tile the mouse is over.

            Comment


              #7
              I am not using any GWT widgets. But if you are referring to line 65
              Code:
              RootPanel.get().add(panel);
              from the test case just replace it with
              Code:
              panel.draw();
              and the behavior is the same.

              Regarding the custom tile, it is extending SimpleTile as you recommend. Anyway the idea was to have a roll over functionality (as seen on ListGrid) on top of the current tile and not to change the layout of the current tile. How can that be done?

              Comment


                #8
                Sorry if we were unclear, but using RootPanel.add() is tantamount to mixing widgets - the "RootPanel" introduces a bunch of GWT DOM and event handling code.

                But that's not actually the problem - it looks like you're just listening to mouseOver on the TileGrid, which can't work - easiest approach is to use mouseMove and detect that the current tile has changed.

                Or again use a customizer and use standard mouseOver functionality or a widget that has a mouseOver behavior of changing CSS styles (eg Label).

                So again you've got two working approaches.

                Comment


                  #9
                  Some background of what I want to do: When the user goes with the mouse over a tile I want to display a canvas with a set of icons(ImgButtons more precicely) over that tile. Each icon will have a click handler with a certain action associated. I have this behavior on a tree grid using the getRollOverCanvas and also want it on a tile grid. This can not be done through CSS.

                  With the mouseMoveHandler the getCurrentTile() method always return a tile even if I am not over a Tile. I still think there is a bug there but it is up to you if you want to fix it or not...

                  Since I am using a custom SimpleTile it seems that the mouseOverHandler on it is the only solution. But there still are 2 problems:
                  1. I do not want to adjust the tile components and layout but rather to display a canvas over it just like getRollOverCanvas does
                  2. How will I know when the mouse is not over the tile anymore so I can hide the canvas?

                  Comment


                    #10
                    1. just make it not a child - re-use the same one and place it over the tile
                    2. use mouseOut

                    Comment


                      #11
                      Your suggestion seems to work except one thing. When you go with the mouse over the rollOverCanvas the tile starts to flicker. Probably because in that moment a mouseOut event for the tile is received which in turn hides the rollOverCanvas and also updates the default css styling for the SimpleTile class. How can this problem be overcome? Test case with the exposed behavior is attached.
                      Attached Files

                      Comment


                        #12
                        We've made a change to make behavior better here.

                        As of tomorrow's builds, getCurrentTile() will indeed return the tile that is currently under the mouse (as opposed to the last tile that was redrawn, either because you moved over it or any other reason) and this will be true whether you're using SimpleTile or a custom tile.

                        At that time, you'll just need a TileGrid mouseMove handler that calls getCurrentTile(), as you tried originally.

                        When you say it "starts to flicker", do you mean it just redraws (flickers) once, or starts flickering?

                        Comment


                          #13
                          It redraws just once for each mouseOver/mouseOut event. Hence the state of the tile is either over or not depending on the last mouse event came last. But as you continuously move the mouse over the rollOverCanvas the sensation is that it flickers.

                          Comment


                            #14
                            Can your confirm your OS and browser versions? And please try your test in other browsers - particularly if you only saw this in Chrome so far.

                            Comment


                              #15
                              Mac OS X 10.15.3, and tried on Firefox 73, Opera 65, Chrome 80 and Safari 13 . The same behavior to all of them.

                              Comment

                              Working...
                              X