[CLOSED] Messagebox prompt set cursor position to end

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [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?


    
            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
                    }
                }
            });
  2. #2

    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 =( .

    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
            }
        }
    });
  3. #3

    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


    Ext.fly(this.body.query('textarea')[0]).focus();

    Hope this helps.


    Geoffrey McGill
    Founder
  4. #4

    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
  5. #5

    RE: [CLOSED] Messagebox prompt set cursor position to end

    how to ask question? tanks
  6. #6

    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.
    Last edited by geoffrey.mcgill; Aug 19, 2010 at 8:04 PM.

Similar Threads

  1. Replies: 9
    Last Post: Nov 23, 2012, 3:13 AM
  2. Replies: 5
    Last Post: Feb 28, 2012, 11:23 AM
  3. [CLOSED] MessageBox prompt with required field
    By jchau in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 23, 2012, 4:39 PM
  4. [CLOSED] Cursor position
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 23, 2011, 4:55 PM
  5. Custom Prompt MessageBox
    By EzaBlade in forum 1.x Help
    Replies: 2
    Last Post: Nov 04, 2009, 11:14 AM

Posting Permissions