PDA

View Full Version : about messagebox fn



cuteleaf
1 Dec 2007, 5:03 AM
Ext.MessageBox.show({
title: 'Feedback',
msg: 'Please enter any feedback you feel is appropriate:',
width:400,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
fn: showResultText
//animEl: 'mb3'
});






function showResultText(btn, text){
console.log(btn);
console.log(text);
//Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);
};




can anyone tell me:what fn is ? and how to send more parameter?(only btn text?)

evant
1 Dec 2007, 5:11 AM
fn is the method that gets called when one of the buttons is clicked. By default, the function receives the button and the text as the parameters. If you need to pass extra ones, you could use createDelegate, http://extjs.com/deploy/dev/docs/?class=Function



Ext.MessageBox.show({
title: 'Feedback',
msg: 'Please enter any feedback you feel is appropriate:',
width:400,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
fn: showResultText.createDelegate(scopeHere, ['your', 'custom' 'parameters'], true)
//animEl: 'mb3'
});

cuteleaf
1 Dec 2007, 5:31 AM
thanks
and how to receive the custom parameters in function showResultText?

hendricd
1 Dec 2007, 5:44 AM
They would be appended to your functions existing parameters (if they exist):




function showResultText(a,b, CustomParam1, CustomParam2, CustomParam3){


}

cuteleaf
1 Dec 2007, 3:03 PM
thanks you two.