Announcement

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

    Bug in CanvasItem

    During development we began noticing this following warning:

    Code:
    [ERROR] [helloworld] - 16:13:14.599:MUP7:WARN:GridBody:isc_MyListGrid_0_body:setTabIndex(): Passed index of 1259. This method does not support setting a tab index greater than 999.  Setting tab index for this widget to 999
        [a]MathFunction.getStackTrace(_1=>undef, _2=>undef, _3=>undef, _4=>undef, _5=>undef)
        Canvas.setTabIndex(_1=>1259)
        ListGrid.updateMemberTabIndex(_1=>[GridBody ID:isc_MyListGrid_0_body])
        Canvas.addChild(_1=>[Canvas ID:isc_Canvas_4], _2=>undef, _3=>undef)
        GridRenderer.addEmbeddedComponent(_1=>[Canvas ID:isc_Canvas_4], _2=>Obj, _3=>3, _4=>undef, _5=>"expand", undef, undef, undef)
        [a]MathFunction.invokeSuper(_1=>[Class GridBody], _2=>"addEmbeddedComponent", _3=>[Canvas ID:isc_Canvas_4], _4=>Obj, _5=>3, _6=>undef, _7=>"expand", _8=>undef, _9=>undef, _10=>undef)
        GridBody.addEmbeddedComponent(_1=>[Canvas ID:isc_Canvas_4], _2=>Obj, _3=>3, _4=>undef, _5=>"expand")
        ListGrid.$81v(_1=>Obj, _2=>null, _3=>[GridBody ID:isc_MyListGrid_0_body], _4=>3, _5=>undef)
        ListGrid.updateRecordComponents()
        GridBody.redraw(_1=>"Layout getting new size", _2=>undef, _3=>undef, _4=>undef)
        Layout.resizeMembers(_1=>Array[2], _2=>Array[2], _3=>false)
        Layout.layoutChildren(_1=>"resized", _2=>0, _3=>539)
        ListGrid.layoutChildren(_1=>"resized", _2=>0, _3=>539)
        Canvas.$t1(_1=>undef)
        Canvas.resizeBy(_1=>0, _2=>539, _3=>undef, _4=>undef, _5=>undef)
        Canvas.resizeTo(_1=>396, _2=>577, _3=>undef, _4=>undef, _5=>undef)
        CanvasItem.$602(_1=>396, _2=>577)
        CanvasItem.sizeCanvas(_1=>undef)
        CanvasItem.getElementHTML(_1=>"Germany", "Germany")
        FormItem.$15r(_1=>"Germany", _2=>true, _3=>true)
        FormItem.getInnerHTML(_1=>"Germany", _2=>true, _3=>true, _4=>undef)
        DynamicForm.getInnerHTML()
        Canvas.$px(_1=>undef)
        Canvas.$p9()
        Canvas.$ra()
        Canvas.redraw(_1=>"setPageRect")
        ** recursed on [a]MathFunction.invokeSuper
    It confused us for a while, until I finally tracked it down to what looks to be a bug in CanvasItem.js. Check out the following method in it:

    Code:
        _setCanvasTabIndex : function (index) {
            //this.logWarn(this.name + " setCanvasTabIndex running - index:" + index);
            var canvas = this.canvas,
                widgets = [];
            if (canvas) this._getCanvasTabDescendents(canvas, widgets);
            
            for (var i = 0; i < widgets.length; i++) {
                canvas = widgets[i];
                
                // clears any pointers to prev/next in auto-tab-order
                canvas._removeFromAutoTabOrder();
                // use the internal method so we don't hit the user-specified tabIndex ceiling
                //this.logWarn("assigning:" + index + " to " + canvas);            
                canvas._setTabIndex(index, false);
                // increment
                
                index += canvas == this.canvas ? 1 : canvas.getTabIndexSpan();
            }
        },
    The apparent bug is the canvas._setTabIndex(index, false); line -- I think it should be passing true and not false. That second argument indicates the tab indexes should be auto-allocated, and passing false indicates that the tab index is being user-set. The problem arises because SmartGWT segregates tab indices between user-allocated (1-999) and auto-allocated (1000+) and throws warnings if a user-allocated tab index is >=1000. _setCanvasTabIndex above is called automatically and is passed an auto-allocated, > 999 index, and so when it tries to set the index of its wrapped canvas as a > 999 user-allocated index, the warning occurs.

    Does that all make sense? I believe the problem exists in both SmartClient 8.2 and 8.3. The way I've found to reproduce that warning is to create a form with a CanvasItem that contains a listGrid in which createRecordComponent is overridden. I've attached a simple SmartGWT project that replicates those conditions -- just run it and resize the grid to a large size to see the warnings pop up.
    Attached Files

    #2
    Thanks for taking the time to debug this. Your analysis appears correct and we're reversing that flag in the method call

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks a lot! Your company's responsiveness to my bug reports is definitely impressing me -- my team is thankful. We just recently started the long process of slowly rewriting a large old (GWT-Ext) app to Smart GWT, so you can expect us to be thoroughly testing all sorts of random functionality as the months go by :)

      Comment


        #4
        Is this fix incorporated in the nightly builds yet?

        Comment


          #5
          Yes, this fix is in place in the latest nightly builds.

          Comment


            #6
            Isomorphic, it looks like the fix you did for this bug was reverted -- in the 3.1p-20121205 build this bug is fixed (the second parameter in the canvas._setTabIndex call is true) but in the latest builds of 3.1p the bug exists again (the second parameter is false). Could you look into why it got reverted and if the fix could be put back in a new nightly?

            Comment


              #7
              This change led to some unintended side effects and had to be reversed.
              We have now made a different change to avoid these warnings - please try the next nightly build (dated June 25 or above)

              Regards
              Isomorphic Software

              Comment


                #8
                This bug still seems to be here... using SmartGWT 5.0
                Is there a recommended work around? Thanks.

                Comment


                  #9
                  We're showing this as fixed. Do you have a test case that reproduces this warning?

                  Comment

                  Working...
                  X