Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:54:55+00:00 2026-06-02T05:54:55+00:00

I set up a message box to display current time. The timer interval set

  • 0

I set up a message box to display current time. The timer interval set as 1000, and there are 2 buttons to start and stop the ‘timer’. When click on the ‘stop’ button it calls the Ext.TaskManager.stop method and update the text in the message box to ‘paused’. However, when clicked the ‘stop’ button and the text changed to ‘Paused’ for just second, it changed back to display current time again. When i tried use Ext.TaskManager.stopAll(); instead of Ext.TaskManager.stop(task), it works! Why? My code as below:

<script type="text/javascript">
Ext.onReady (function(){
            var config={
            msg:'Display Time',
            modal:true,
            buttons:Ext.Msg.OKCANCEL,
            fn:displayTime
            }

        Ext.MessageBox.msgButtons[0].setText('Start');
        Ext.MessageBox.msgButtons[3].setText('Stop');                
        Ext.MessageBox.show(config); 
        function displayTime(id){
            if(id=='ok'){
                var task = {
                    run:function(){Ext.MessageBox.updateText ('????:' + Ext.util.Format.date(new Date(), 'Y-m-d g:1:s A'));},        
                    interval:1000                            
                    }                   
                Ext.TaskManager.start(task);
            }             
            else {
                Ext.MessageBox.updateText('Paused!');
                Ext.TaskManager.stop(task);
            }    
    };       
    });

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:54:56+00:00Added an answer on June 2, 2026 at 5:54 am

    The task is defined in the if so when the else is hit it is essentially running Ext.TaskManager.stop() which won’t stop your task. Move your task outside of the function declaration.

            var task = {
                run: function () {
                    Ext.MessageBox.updateText('????:' + Ext.util.Format.date(new Date(), 'Y-m-d g:1:s A'));
                },
                interval: 1000
            }
    
    
            function displayTime(id) {
                if (id == 'ok') {
                    Ext.TaskManager.start(task);
                } else {
                    Ext.MessageBox.updateText('Paused!');
                    Ext.TaskManager.stop(task);
                }
            };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display a message box with an OK button. I used the
Why does this program correctly display a message box, but does not set the
How can I display an image in a message box. I tried about.setIcon(:/pics/goku3.jpg); but
in C# winforms when we display a message box it has no title in
I'm trying to send post using API feed. I set fields: message , link
I am creating one application for student. I need to set the different message
I need to set up a job/message queue with the option to set a
I would like to set up an error page which will diplay a message
I'm storing a set of messages in a SQL table. Each message has a
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Web.Services2.WebServicesExtension.AfterSerializeServer(SoapServerMessage message)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.