[CLOSED] Messagebox prompt set cursor position to end
I want to show a messagebox prompt with textarea initally filled. Is it possible to set the cursor position of the textarea when it is shown so users can start typing and append to current value?
Code:
Ext.MessageBox.show({
title: 'Quick Search',
msg: 'Enter search text:',
width: 400,
buttons: Ext.MessageBox.OKCANCEL,
multiline: 200,
value: 'Initial Text To Append To - ',
fn: function(btn, text) {
if (btn == 'ok') {
//do my own thing
}
}
});
RE: [CLOSED] Messagebox prompt set cursor position to end
This works but I dont like the way I have to access the textarea of the window. If you know of a better way, please let me know. I looked at the source code and everything is private =( .
Code:
var win = Ext.MessageBox.getDialog();
win.on('show',
function() {
// utility function to set cursor pos given a textbox
// StrataWeb.Util.setTextboxCursor(Ext.MessageBox.getDialog().body.query('textarea')[0]);
},
null,
{ single: true }
);
Ext.MessageBox.show({
title: 'Quick Search',
msg: 'Enter search text:',
width: 400,
buttons: Ext.MessageBox.OKCANCEL,
multiline: 200,
value: 'Some Text - ',
fn: function(btn, text) {
if (btn == 'ok') {
//do my own thing
}
}
});
RE: [CLOSED] Messagebox prompt set cursor position to end
ya, that's not too pretty. I had a quick look at the api, but could only come up with was the following...
Example
Code:
Ext.fly(this.body.query('textarea')[0]).focus();
Hope this helps.
RE: [CLOSED] Messagebox prompt set cursor position to end
Thanks Geoffrey. You can mark this as solved. Let just hope they dont replace that textarea ever =P
RE: [CLOSED] Messagebox prompt set cursor position to end
how to ask question? tanks
RE: [CLOSED] Messagebox prompt set cursor position to end
hello,I want to ask some question ,but ,wo don't know how to ask ,please help me ,thanks.