Announcement

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

    SmartClient 7.0rc2:Patch for IE-only issue for click handling on images in a Grid

    This patch corrects an Internet-Explorer only issue in 7.0rc2 whereby if a ListGrid is created with embedded .png type images, clicking on those images can cause click handling for cells within the grid to fail when the grid is scrolled fully into view in response to recieving native browser focus.
    Note that this bug can only occur if the ListGrid body is partially clipped by a scrollable container when clicked.

    Code:
    // Patch for SmartClient 7.0rc2
    // This resolves an issue where in Internet Explorer browsers, clicking on
    // a .png based image in a GridRenderer cell could in some cases cause 
    // click events to fail to fire on the target row when the GR recieved focus.
    if (window.isc) {
    	if (isc.version.startsWith("7.0rc2")) {
    
    isc.EH.addClassProperties({
     
      doHandleMouseDown: function(_1,_2){
       if(!isc.Page.isLoaded())return false;
       var _3=this;_3.$j6=true;
       var forceIEFocusTarget;
       var _4=_2||_3.getMouseEventProperties(_1);
       var _5=_3.$ke,
       	_6=_5!=null&&(_5!=_4.target)&&!_5._useNativeTabIndex&&!_5.$kn&&!(isc.isA.DynamicForm!=null&&isc.isA.DynamicForm(_5)&&_5.getFocusItem()&&_5.getFocusItem().hasFocus);
        if(_6){
        	    if(isc.Browser.isIE){
        	    	    var _7=_3.$ke.getID();
        	    	    if(_3.$ko==null) _3.$ko=["if (",_7," && ",_7,".hasFocus)",_7,".blur()"]
    		    else _3.$ko[1]=_3.$ko[3]=_3.$ko[5]=_7;
    		isc.Timer.setTimeout(_3.$ko.join(isc.emptyString),0)
    	    }else{_3.$ke.blur()}
        }
        _3.mouseDownEvent=isc.addProperties({},_4);
        var _8=_4.target;
        var _9=(_3.clickMaskClick(_8)==false);
        if(_9){_3.$kp=true;return false}else{_3.$kp=false}
        var _10=_3.rightButtonDown()?_3.RIGHT_MOUSE_DOWN:_3.MOUSE_DOWN;
        if(isc.Page.handleEvent(_8,_10)==false){return false}
        if(_3.eventHandledNatively(_10,_4.nativeTarget)) return _3.$js;
        if(!_3.targetIsEnabled(_8))return false;
        if(_8&&!_8.hasFocus){
        	    if(((isc.Browser.isMoz&&_8.canSelectText)||isc.Browser.isSafari)&&_8.$kn) {
        		_3.focusInCanvas(_8)
        	    }else if(!_8._useNativeTabIndex){
        		_8.focus()
    	    }else if(isc.Browser.isMoz){
        		_8.focus()
        	    }else if(isc.Browser.isIE){
        		var _11=_4.nativeTarget;
                    if(_11&&_11.tagName==this.$jg){
        			var _12=_11.style,_13=_12?_12.filter:null;
                           if(_13.contains(this.$jh)){
                                forceIEFocusTarget = _8;
                           }
        		}
        	    }
        }
        if(_8)_3.prepareForDragging(_8);
        var _14=_3.bubbleEvent(_8,_10,null,_9);
        if(_14==false){delete _3.dragTarget;delete _3.dragTargetLink}
        if (forceIEFocusTarget != null) forceIEFocusTarget.focus();
    
        if(_3.rightButtonDown()){
        	    if(!this.useSyntheticRightButtonEvents())return true;
        	    if(_8&&(_3.getBubbledProperty(_8,"contextMenu")||_3.getBubbledProperty(_8,"showContextMenu")!=isc.Canvas.getInstanceProperty("showContextMenu"))) {
        	    	_4.returnValue=false;
        	    	return false
        	    }
    	return true
        }
        if(_14!=false){
        	if(_3.hasEventHandler(_8,_3.MOUSE_STILL_DOWN)){_3.$kq()}
        }
        var _15=_3.dragTarget!=null;
        var _16=(!_15&&(!(isc.Browser.isMoz||isc.Browser.isSafari)||!!_8.$kr(_4)));
        return _16
      }
    
    });
    
    isc.GridRenderer.addProperties({
    		mouseDown:function(){
    			if(this.$29p())return;
    			var _1=this.getEventRow(),_2=this.getEventColumn();
    			if(!(_1>=0&&_2>=0))return;
    			if(!this.cellIsEnabled(_1,_2))return false;
    			this.$29u=_1;this.$29v=_2;
    			this._mouseDownX = isc.EH.getX();
    			this._mouseDownY = isc.EH.getY();
    			
    			var _3=this.getCellRecord(_1,_2);
    			if(!isc.EH.rightButtonDown()){
    				return this.$29w(_3,_1,_2)
    			}else{
    				return this.$29x(_3,_1,_2)
    			}
    		},
    		$29y:function(_1,_2){
    			this.$29z=this.$290=null;
    			// mouseDownRow != event row? - check for focus/scroll case
    			if (_1 != this.$29u) {
    				if (isc.EH.getX() == this._mouseDownX) _1 = this.$29u;
    				if (isc.EH.getY() == this._mouseDownY) _2 = this.$29v;
    			}
    			if(!(_1>=0&&_2>=0))return;
    			if(!this.cellIsEnabled(_1,_2))return false;
    			var _3=this.$29u;
    			if(_1!=_3)return false;
    			this.$29z=_1;
    			var _4=this.getCellRecord(_1,_2),
    			    _5;
    			if(!this.$22n(_4,_1,_2))_5=false;
    			if(this.rowClick&&(this.rowClick(_4,_1,_2)==false))_5=false;
    			this.$29u=null;
    			return _5
    		}
    
    });
    
    	} else isc.Log.logWarn("Patch code for SmartClient 7.0rc2 and rc3 included in this application. " +
    		"You're running version:" + isc.version + ". Patch code will have no effect and can be removed.");
    }
    Last edited by Isomorphic; 14 Apr 2010, 17:28.
Working...
X