1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    64
    Vote Rating
    0
    bluesapphire is on a distinguished road

      0  

    Question How to Automatically Close 'Alert' after sometime

    Hi!
    How can an 'Alert' messagebox be closed after specific time, without clicking on 'OK' button.

    Thanks in advance

  2. #2
    Ext User Blackhand's Avatar
    Join Date
    May 2008
    Posts
    42
    Vote Rating
    0
    Blackhand is on a distinguished road

      0  

    Default

    This completely untested =), but you could try something like this.

    Code:
    var alertWindow = Ext.Msg.alert('Alert', 'An alert!');
    
    (function() {
       alertWindow.hide();
    }).defer(10000);

  3. #3
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    83
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default

    Quote Originally Posted by Blackhand View Post

    Code:
    Ext.MessageBox.alert('Alert', 'An alert!');
    
    (function() {
       Ext.MessageBox.hide();
    }).defer(10000);
    Modified to work

    Ext.MessageBox is a singleton, thus a ref is not necessary.

  4. #4
    Ext User Blackhand's Avatar
    Join Date
    May 2008
    Posts
    42
    Vote Rating
    0
    Blackhand is on a distinguished road

      0  

    Default

    Thanks jgarcia, and yes you are correct, a reference is not needed.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Posts
    210
    Vote Rating
    1
    KRavEN is on a distinguished road

      0  

    Default

    Shorter Ext.MessageBox.hide.defer(1500,this); also works

  6. #6
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    83
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default

    Quote Originally Posted by KRavEN View Post
    Shorter Ext.MessageBox.hide.defer(1500,this); also works
    you sure you want the hide method to execute within the scope of window or whatever Object this references?