try this
Ext.create('Ext.window.Window', {
bodyPadding: '5 5 5 5',
items: [
{
xtype: 'textfield',
name: 'firstName',
emptyText: 'First Name',
width: 250
},
{
xtype: 'button',
text: 'click me',
handler: function() {
var value1 = Ext.ComponentQuery.query('textfield[name=firstName]')[0].getValue();
console.log(value1);
var value2 = this.up('window').down('textfield[name=firstName]').getValue();
console.log(value2);
}
}
]
}).show();