PDA

View Full Version : drag&drop - customize window



golden_wing
21 Sep 2009, 11:20 PM
hey there
this Tutorial (http://www.extjs.com/learn/Tutorial:Custom_Drag_and_Drop_Part_1) showed me how to custimize elements while drag and drop them. However this won't work with windows since they ain't go no startDrag event...

I already tried



Ext.override(Ext.Window, {
startDrag: function(x, y) {
alert("hello");
},
});


but doesn't work

anybody an idea?

Animal
21 Sep 2009, 11:48 PM
http://www.extjs.com/deploy/dev/docs/?class=Ext.Window&member=dd

Use the "Hide inherited members" button!

http://i131.photobucket.com/albums/p286/TimeTrialAnimal/hideinherited.jpg

golden_wing
22 Sep 2009, 1:05 AM
oh ok... didn't see that one...:">
however now I know that a window's drag&drop is controlled by the Ext.dd.DD Class

now in order to add some new content I have to extend this class


Ext.namespace('MyLib');
MyLib.DD = Ext.extend(Ext.dd.DD,{
startDrag : function(){
alert('fobar.');
MyLib.DD.superclass.startDrag.apply(this, arguments);
}
});


and change window's dd-type


Ext.override(Ext.Window,{
dd:MyLib.DD
});


But still I don't get an alert.... any idea? did I miss something?

golden_wing
22 Sep 2009, 3:15 AM
Ok i kind of figured it out ;)

in order to add some new features I have to extend the superclass


Ext.namespace('MyLib');
MyLib.DD = Ext.extend(Ext.dd.DD,{
startDrag : function(){
alert("foobar");
MyLib.DD.superclass.startDrag.apply(this, arguments);
}
});

Now change the type of window's dd


Ext.override(Ext.Window,{
dd:MyLib.DD
});

But alert is not showing up. Did I miss someting?

hendricd
22 Sep 2009, 3:33 AM
var wDD = Ext.Window.DD;
Ext.override(wDD, {
b4Drag : wDD.prototype.b4Drag.createInterceptor(function(){
alert('before');
}),
startDrag : wDD.prototype.startDrag.createInterceptor(function(){
alert('starting');
}),
endDrag : wDD.prototype.endDrag.createInterceptor(function(){
alert('dropped');
})
});

golden_wing
22 Sep 2009, 3:57 AM
yeah it's working... thanks :)