PDA

View Full Version : how to catch event while moving or dragging a panel/window



vnggui
17 Oct 2013, 9:09 AM
I want drag/move a window/panel and dynamically get position and zIndex of it.
I can move a window on viewport but can't catch a proper trigger event.
Any idea?




Ext.define('MyApp.controller.PubSub', {
extend: 'Ext.app.Controller',

init:function(){
this.control({
'#mypanelid':{
render:this.panelRender
},

'button[text=MyButton]':{
click: this.btnClick
},

'#windowid':{
resize:this.resizeWindow
//not being triggered
//move:this.dragWindow
//drag:this.dragWindow
},


});

this.application.on({

});
},

panelRender:function(){
console.log('......');
},

btnClick:function(){
console.log('click click');
alert('click click');

},

resizeWindow:function(e){
var top = e.y,
left = e.x,
width = e.width,
height = e.height;

console.log('top:'+top+', left:'+left+', width:'+width+', height:'+height);
},

dragWidnow:function(e){
var top = e.y,
left = e.x,
width = e.width,
height = e.height;

console.log('top:'+top+', left:'+left+', width:'+width+', height:'+height);

}
});



46388

thanks,

vng

vnggui
17 Oct 2013, 9:23 AM
Have to use dragZone (Ext.dd) to implement a moving component ?
If not, what else?
If yes, how to do it in tablet (as Sencha toucn not support Ext.dd) ?

Gary Schlosberg
22 Oct 2013, 5:57 AM
You might have a look at the portal example for help in how to implement dragdrop of a panel.
http://docs.sencha.com/extjs/4.2.1/#!/example/portal/portal.html

As far as the tablet, ExtJS is not supported in mobile devices. Not much help for you now, but it will be supported in the 5.x release, but I can't speak to whether dragdrop will be part of it.

vnggui
22 Oct 2013, 10:49 AM
Thanks for your reply. where can I get the source of the portal link?

As to Sencha touch, 5.x release means touch 2.5 (current is 2.3)? What's the hardest part for touch can't put in DD right now as you best to know?

vng

Gary Schlosberg
22 Oct 2013, 11:17 AM
Sorry for the confusion. By 5.x, I meant ExtJS 5.x, in which plans are to add support for mobile devices. Unfortunately, since Touch doesn't support dragdrop that I know of, it wouldn't surprise me if ExtJS 5.x also didn't have support for it.

vnggui
22 Oct 2013, 11:22 AM
Where can I get the source of the portal you referred to?

By the way, after 5.x, Sencha may use 2-in-one API instead of 2 separate libraries, right?

thanks

Gary Schlosberg
22 Oct 2013, 11:33 AM
I have only heard that ExtJS will start having limited support for mobile devices so I wouldn't hold your breath for a single API just yet. Would be cool though.

The code for the example can be found in the distribution at examples/portal/portal.* .

Gary Schlosberg
24 Oct 2013, 11:29 AM
Meant to post this link earlier:
http://www.sencha.com/blog/ext-js-on-tap/