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 8643523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:03:59+00:00 2026-06-12T12:03:59+00:00

I have an interface that calls a script for spreadsheet creation using data taken

  • 0

I have an interface that calls a script for spreadsheet creation using data taken from other spreadsheet. I want the interface to update its labels at runtime in order to give visual feedback to the user and let him know the script is running and it’s not stuck. When I try to update the label I put in the interface, it doesn’t update the first time, but updates correctly after myFunction() reaches its end. Which means I can see the message “Creation Completed”, but the message “Creating file…” is never shown. Also, the button buttonCompile is never disabled so it seems that the instructions before myFunction() are not executed at all. How can I get the labels updated and the button disabled before myFunction() starts executing? (I already double-checked variable references)

function doGet() {
  var app = UiApp.createApplication();
  app.add(app.loadComponent("File creation"));
  var buttonCreate = app.getElementById('createBtn');
  var handlerCrea = app.createServerHandler('createClickHandler');
  buttonCreate.addClickHandler(handlerCreate);
  return app;
}

function createClickHandler(e) {
  var app = UiApp.getActiveApplication();
  var label = app.getElementById('createLbl');
  label.setText("Creating file...");
  var buttonCompile = app.getElementById('compileBtn');
  buttonCompile.setEnabled(false);
  myFunction();
  label.setText("Creation completed.");
  buttonCompile.setEnabled(true);
  app.close();
  return app;
}
  • 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-12T12:04:01+00:00Added an answer on June 12, 2026 at 12:04 pm

    The cause of this behavior is that the GUI is updated only after leaving a handler. A workaround is to use two handlers. The 1st one sets the label text to Creating file... and disables the button, the 2nd one executes the myFunction function, changes the text to Creation completed, and eanbles the button. Here is an example. It disables/enables the button and the worker handler simply waits 5 seconds.

    function doGet(e) {
      var app = UiApp.createApplication();
      var container = app.createHorizontalPanel().setId('container');
      var btnPerformance = app.createButton("Performance Demo").setId('btnPerformance');
      var handlerPerformance = app.createServerHandler('onBtnPerformanceClick');
      var handlerWait = app.createServerHandler('onWait');
      btnPerformance.addClickHandler(handlerPerformance);
      btnPerformance.addClickHandler(handlerWait);
      container.add(btnPerformance);
      app.add(container);
      return app;
    }
    
    function enableControls(enable) {
      var lstControls = [ 'btnPerformance' ];
      var app = UiApp.getActiveApplication();
      for (var i = 0; i < lstControls.length; i++) {
        var ctl = app.getElementById(lstControls[i]);
        ctl.setEnabled(enable);
      }
    }
    
    function onWait(e) {
      enableControls(false);
      return UiApp.getActiveApplication();
    }
    
    function onBtnPerformanceClick(e) {
      Utilities.sleep(5000);
      enableControls(true);
      return UiApp.getActiveApplication();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CGI interface that calls a Perl plugin. Those scripts are located
I have an object that implements an interface. I want to call on the
I have an interface that contains a single method called ListAll() using System.Collections.Generic; namespace
I have an interface that, among other things, implements a public IEnumerator GetEnumerator() method,
I have an interface that I want to implement in separate classes after doing
I have an IRepository interface that inherits from IRepository<TObject> . I also have a
Couch has a REST interface. This means that data-updates are exclusive to PUT calls.
I have a REST web-service interface that calls-down to a service layer which orchestrates
I have a Python script I recently wrote that I call using the command
I have a signup form that calls a PHP script which can interact with

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.