[CLOSED] MessageBox with Delay

  1. #1

    [CLOSED] MessageBox with Delay

    Hello,

    is it possible to show a MessageBox on clientside with a given delay? For example delay="5000"?

    Regards,

    Martin
    Last edited by geoffrey.mcgill; Jul 30, 2010 at 8:39 PM.
  2. #2
    Hello, macap!

    Please look at two ways to do it.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug"/>
        <form id="Form1" runat="server">
            <ext:Button runat="server" Text="MessageBox with using Delay property">
                <Listeners>
                    <Click Handler="Ext.Msg.alert('Some title','Some message');" Delay="5000"/>
                </Listeners>
            </ext:Button>
            <ext:Button runat="server" Text="MessageBox with using setTimeout function">
                <Listeners>
                    <Click Handler="setTimeout(function() {Ext.Msg.alert('Some title','Some message');}, 5000);"/>
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    You can use
    setTimeout(function() {Ext.Msg.alert('Some title','Some message');}, 5000);
    at any place of JavaScript code.
  3. #3
    Also you can use the defer function that defined in the ExtJS Function class.
    http://www.sencha.com/deploy/dev/docs/?class=Function

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET Example</title>
        <script type="text/javascript">
            var showMessage = function() {
                Ext.Msg.alert('Some title', 'Some message');
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug"/>
        <form id="Form1" runat="server">
            <ext:Button ID="Button1" runat="server" Text="MessageBox with using defer">
                <Listeners>
                    <Click Handler="showMessage.defer(5000);"/>
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  4. #4
    Here's another .defer option. I just happen to be working on almost this exact line of code when I read this thread.

    Enables all code in a single line without having to call a custom js function.

    Example

    <Click Handler="Ext.Msg.alert.defer(5000, Ext.Msg, ['your title', 'your message']);"/>
    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. mask delay
    By norphos in forum 1.x Help
    Replies: 3
    Last Post: Jul 21, 2011, 7:25 AM
  2. [CLOSED] Buffer vs Delay
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 07, 2011, 6:34 PM
  3. [CLOSED] Delay on success
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 25, 2010, 6:28 PM
  4. [CLOSED] Tooltip delay
    By danielg in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 09, 2009, 2:10 PM
  5. Render delay
    By oskarni in forum 1.x Help
    Replies: 5
    Last Post: Mar 03, 2009, 12:49 PM

Posting Permissions