Results 1 to 5 of 5

Thread: probleme Event ie firefox

  1. #1

    Default probleme Event ie firefox

    Hi!

    I have try to enable the drawing on a div using event ( mousedown, mousemove, moveup ).

    On Firefox, all is fine. But On IE, the event are not set so it does not work, The events are set with the function InitCaptureEvent . The function OnStartDrag is never fired.


    Does someone know why?

    Thanks a lot





    javascript :

    Code:
    Drawer = function ( config )
    {
    	this._id = config;
    
    	this.init ( config );
    }
    
    Drawer.prototype = 
    {
    	
    	_id : null,
    	_xyStartBody : null,
    	_xyStartElement : null,
    	_element : null,
    	
    	
    	init : function ( config )
    	{
    		//ApplyConfig ( config, this );
    		
    		this._element = YAHOO.ext.Element.get ( this._id );
    		
    		this.InitCaptureEvent ();
    		
    	},
    	
    	OnStartDrag : function ( evt )
    	{
    		//alert("start");
    		this._xyStartBody = YAHOO.util.Event.getXY ( evt );
    		this._xyStartElement = [ this._xyStartBody[0] - this._element.getX(), this._xyStartBody[1] - this._element.getY() ];
    		this._element.on ( "mousemove", this.OnMouseMove, this );
    	},
    	
    	OnMouseMove : function ( evt )
    	{
    		var XY = YAHOO.util.Event.getXY ( evt );
            
            var w = Math.abs ( XY[0] - this._xyStartBody[0] );
            var h = Math.abs ( XY[1] - this._xyStartBody[1] );
    		
    		//console.log ( "DRAG = x:%d,y:%d,w:%d,h:%d", this._xyStartElement[0], this._xyStartElement[1], w, h );
    	},
    	
    	OnEndDrag : function ( evt )
    	{
            var XY = YAHOO.util.Event.getXY ( evt );
    		
            var w = Math.abs ( XY[0] - this._xyStartBody[0] );
            var h = Math.abs ( XY[1] - this._xyStartBody[1] );
    		
    		alert ( "END DRAG = x:"+this._xyStartElement[0]+",y:"+this._xyStartElement[1]+",w:"+w+",h:"+h  );
    		//console.log ( "END DRAG = x:%d,y:%d,w:%d,h:%d", this._xyStartElement[0], this._xyStartElement[1], w, h );
            this.ReleaseCaptureEvent();
    	},
    	
    	InitCaptureEvent : function ()
    	{   
    		this._element.on ( "mousedown", this.OnStartDrag, this );
    		this._element.on ( "mouseup", this.OnEndDrag, this );
    		//alert("start_");
    	},
    	
    	
    	ReleaseCaptureEvent : function ()
    	{
    		this._element.removeAllListeners ( );
    	}
    }
    var drawer = new Drawer ( "main" );



    HTML :
    Code:
    <div id="main" style="position:absolute;left:150px;width:800px;height:600px;border:1px solid blue;">

  2. #2

    Default

    Any idea.

    I thinkthat the event where managed for both ie and firefox and it doesn't work for IE.

    I don't understand why.

    Thanks for help

  3. #3
    Sencha Premium Member hcristea's Avatar
    Join Date
    Mar 2007
    Posts
    33

    Default

    Try using: mon instead of on:

    Code:
          this._element.mon ( "mousedown", this.OnStartDrag, this );
          this._element.mon ( "mouseup", this.OnEndDrag, this );
    The difference between mon and on is that mon will add a managed listener, you will get a YAHOO.ext.EventObject instead of the standard browser event.

  4. #4

    Default

    thanks

    I'll try it as soon as possible.

    thanks again.

  5. #5

    Default

    It does not works.

    It worst because the event are now relative to body and no on the element.

    Sorry.

    Any Idea?

Similar Threads

  1. how to stop click event when having dblclick event
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 8 Nov 2011, 12:31 AM
  2. Probleme TreePanel and MultiSelectionModel
    By alex1er in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 14 Nov 2007, 3:36 AM
  3. createStyleSheet probleme
    By alex1er in forum Ext 1.x: Bugs
    Replies: 0
    Last Post: 29 Mar 2007, 6:07 AM
  4. Probleme ctrl + click
    By alex1er in forum Ext 1.x: Bugs
    Replies: 4
    Last Post: 22 Feb 2007, 8:10 AM
  5. Jsonview probleme
    By alex1er in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 15 Jan 2007, 7:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •