PDA

View Full Version : How to handle an event after dragging the draw component



tsuryap
28 Oct 2012, 11:43 PM
i had created a draw component and adding to window.......

Ext.create('Ext.draw.Component', {
renderTo: Ext.getBody(),
draggable:true,
width: 200,
height: 200,
items: [{
type: "ellipse",
radiusX: 100,
radiusY: 50,
x: 100,
y: 100,
fill: 'red'
}]
});


Ext.create('Ext.Window', {
width: 500,
height: 500,
layout: 'fit',
items: [drawComponent]
}).show();

help me how to fire an event after dragging this drawcomponent ....what event should be added in the listeners

sword-it
29 Oct 2012, 5:34 AM
Hi Tsuryap,

You can use move listeners of draw component, like -


var drawComponent = Ext.create('Ext.draw.Component', {

draggable:true,
width: 200,
height: 200,
listeners:{
move:function(){
alert('hi');
}
},
items: [{
type: "ellipse",
radiusX: 100,
radiusY: 50,
x: 100,
y: 100,
fill: 'red'
}]
});


Ext.create('Ext.Window', {
width: 500,
renderTo: Ext.getBody(),
height: 500,
layout: 'fit',
items: [drawComponent]
}).show();


http://docs.sencha.com/ext-js/4-1/#!/api/Ext.draw.Component-event-move

tsuryap
30 Oct 2012, 1:27 AM
thankyou very much it is working......