PDA

View Full Version : Ext.Window mouseover



samotnik
16 Jun 2010, 6:21 AM
Hi.
Could you please help me.
I try to implement this functionality
mouseover => window should be closed.
I make is so :


var toolTipWw = new Ext.Window({
html: 'some HTML',
id: 'ttID',
autoScroll: true,
constrain: true,
width: '35%',
title: 'title',
listeners: {
'render': function (w) {
w.getEl().on('mouseout', function(e) {
if(!e.within(w.getEl(), true)) {
toolTipWw.close();
}
}, this);
}
}
});
It's working fine. BUT. When I try to DRAG this window I get an error b.dom is undefined
What should I do?

rbastic
16 Jun 2010, 6:43 AM
have some events that detect mousedown/mouseup

and then consider if the mousedown is active during the chunk:
w.getEl().on('mouseout', function(e) {
if(!e.within(w.getEl(), true)) {
toolTipWw.close();
}
}, this);

...
reason for this is because i THINK your render code is firing during both drag and mouseout??? so you want to ensure that it's not firing during the drag event, i think.

might be totally wrong. just a guess.

Animal
16 Jun 2010, 6:44 AM
Your mouseout function fires when you drag because the Window is replaces by a ghost as you can see.

And then, http://www.sencha.com/deploy/dev/docs/?class=Ext.Window&member=close

samotnik
16 Jun 2010, 6:54 AM
Thanks, mr. Animal.
Could you please tell. Which solution of this problem exist ?

Animal
16 Jun 2010, 6:58 AM
Disable ghosting so that the actual Window element itself is dragged:



new Ext.Window({
title: 'Drag me',
height: 100,
width: 200,
ghost: function() {
return this.el;
}
}).show();

samotnik
16 Jun 2010, 7:12 AM
THANKS !!!!! A LOT !

samotnik
16 Jun 2010, 8:20 AM
OH!
I have a new problem. When I drag my window very fast - I get a new error a is undefined
:(

Animal
16 Jun 2010, 9:31 AM
Well don't use ext-all.js then, use ext-all-debug.js and see what is undefined and where and why by debugging.

samotnik
17 Jun 2010, 5:46 AM
mr. Animal, thank you.
I debugged it. And I have got next situation :
I click on my window, drag it, then if I very fast move mouse out of the window. I get an error :


style is undefined
style.left = me.addUnits(left);
ext-all-debug.js (line 4931)

Animal
17 Jun 2010, 5:48 AM
And when you set a break there, why is that happening?

samotnik
17 Jun 2010, 5:51 AM
because, in the code (line 4931 in the ext-all-debug.js) style is undefined

setLeftTop : function(left, top){
var me = this,
style = me.dom.style;
style.left = me.addUnits(left);
style.top = me.addUnits(top);
return me;
},

Animal
17 Jun 2010, 5:55 AM
me.dom.style is undefined?

So what is me.dom, therefor what is me (ie "this").

Go back through the call stack to see what object setLeftTop is being called upon and why..... blah blah.... debug basically.

samotnik
17 Jun 2010, 6:16 AM
ok, thank you very much !!!