Back

showProgressDialog

JS Py
Hello World
Content:
- Examples
- Properties
- Methods

A ProgressDialog is a pop-up dialog that indicates the progress of a task, often accompanied by a loading spinner or bar.

prd = ui.showProgressDialog( text?, options? ) → ui object: ProgressDialog

Here are the available methods for the ProgressDialog Component.

Examples

Example - Progress Dialog

class Main extends App
{
    onStart()
    {
        // Creates a fullscreen layout with objects vertically centered.
        this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")

        // Add a button to the main layout
        this.btn = ui.addButton(this.main, "Show Progress Dialog", "Outlined")

        // Add a callback handler when the button is click
        this.btn.setOnTouch( this.onTouch )
    }

    onTouch()
    {
        // Show a progress dialog with `AutoCancel` the dismisses on backdrop click
        ui.showProgressDialog("Loading...", "AutoCancel")
    }
}
from hybrid import ui

def OnStart():
    main = ui.addLayout("main", "Linear", "VCenter,FillXY")
    btn = ui.addButton(main, "Show Progress Dialog", "Outlined")
    btn.setOnTouch(onTouch)

def onTouch(event):
    ui.showProgressDialog("Loading...", "AutoCancel")
Copy All       Run      

Example - Nocancel progress dialog

class Main extends App
{
    onStart()
    {
        // Creates a fullscreen layout with objects vertically centered.
        this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")

        // Add a button to the main layout
        this.btn = ui.addButton(this.main, "Show Progress Dialog", "Outlined")

        // Add a callback handler when the button is click
        this.btn.setOnTouch( this.onTouch )
    }

    onTouch()
    {
        // Show a progress dialog with `AutoCancel` the dismisses on backdrop click
        this.pdlg = ui.showProgressDialog("Loading...", "NoCancel")

        // hide the progress dialog after 2 seconds
        setTimeout( () => {
            this.pdlg.hide()
            ui.showPopup( "Progress dialog is close!" )
        }, 2000)
    }
}
from hybrid import ui

def OnStart():
    main = ui.addLayout("main", "Linear", "VCenter,FillXY")
    btn = ui.addButton(main, "Show Progress Dialog", "Outlined")
    btn.setOnTouch(onTouch)

def onTouch(event):
    pdlg = ui.showProgressDialog("Loading...", "NoCancel")

    def hideProgressDialog():
        pdlg.hide()
        ui.showPopup("Progress dialog is close!")

    app.SetTimeout(hideProgressDialog, 2000)
Copy All       Run      

Properties

The following properties are available on the ProgressDialog object:

textString

Methods

The following methods are available on the ProgressDialog object:

hide()
show()
String: “The text message of the progress dialog.”
String: “A comma separated options.
`AutoCancel` to close the dialog when backdrop is click.”
function()
prd.hide
Hides the dialog component.
prd.setOnClose
Adds a callback handler method on close event.
prd.show
Show the progress dialog component.
prd.text
Sets or returns the ProgressDialog text.