ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Progress bar functions
  • Example for the ProgressBarEnable function
ProgressBarEnable (Example)
Example for the ProgressBarEnable function
Process with progress bar when loading the page
//---- In the global declarations of the page
// Variable used to find out whether the process with progress bar must be started
gbStartProgBarProcess is boolean = True
//---- In the load process of the page (browser OnLoad):
// Check whether the process that needs a progress bar must be started
IF gbStartProgBarProcess = True THEN
// Runs the button/link that needs a progress bar
ExecuteProcess(LINK_Server_Process_With_Progress_Bar, trtClick)
END
//---- Browser code (OnClick) of LINK_Server_Process_With_Progress_Bar button
// Enable the progress bar
// (it is updated every second
// and it will automatically stop at the end of the server process)
ProgressBarEnable(PROGBAR_AJAX_WEBDEV, 1*100, True)
// Runs the long server process (the one used to update the progress bar)
// a - In a procedure that can be run by Ajax:
// In this case, the button must have "no" action on the controls
AJAXExecuteAsynchronous(LongServerProcess, "EndProcess")
// b - The server process of button (that must not be Ajax)
// Case a (Using AJAXExecuteAsynchronous)
//---- Browser procedure (the one specified in AJAXExecuteAsynchronous)
PROCEDURE EndProcess()
Info("Done")
OR
// Case b (Call to the procedure in the server code of the NON-AJAX button)
//---- Server code of LINK_Server_Process_With_Progress_Bar (non AJAX) button
LongServerProcess()
Info("Done")
//----Server procedure needing the progress bar
PROCEDURE LongServerProcess()
 
// In order for the process not to be restarted during the next page load
gbStartProcessProgBar = False
 
// Process itself
// Loop on a value (set to 10 for the example)
nMaxLoop is int = 10
FOR nIndex = 1 _TO_ nMaxLoop
// Update the value of the progress bar
// The upper bound of the progress bar being set to 100,
// assign the % of completed process to the progress bar
PROGBAR_AJAX_WEBDEV = nSubscript/nMyLoop * 100
// Process itself
// ....
// A timeout is set to 1 second for the example
Multitask(1 * 100)
END
Minimum version required
  • Version 16
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help