Back

addProgress

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

A progress refers to the visual indication of a task's completion status.

prg = ui.addProgress( parent, value?, options?, width?, height? ) → ui object: Progress

If you pass a null value on initialization and you won't passed a variant option, the default variant will be indeterminate.
Otherwise if there's no variant option and the value is not null, it will automatically be a determinate variant.

Here are the available methods for the Progress Component.

Examples

Example - Progress control implementation

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

        // Indeterminate Linear
        this.prog1 = ui.addProgress(this.main, 40, "linear", 0.7)

        // Determinate Linear
        this.prog2 = ui.addProgress(this.main, null, "Linear,Secondary,indeterminate", 0.7)

        // Determinate Circular
        this.prog3 = ui.addProgress(this.main, 50, "Circular")

        // Indeterminate Circular, enlarge and secondary
        this.prog4 = ui.addProgress(this.main, null, "Circular,Secondary,indeterminate")
        this.prog4.circleSize = 100
    }
}
class Main extends App
    onStart()
        # Creates a fullscreen layout with objects vertically centered.
        this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
        this.main.childSpacing = "Even"

        # Indeterminate Linear
        this.prog1 = ui.addProgress(this.main, 40, "linear", 0.7)

        # Determinate Linear
        this.prog2 = ui.addProgress(this.main, null, "Linear,Secondary,indeterminate", 0.7)

        # Determinate Circular
        this.prog3 = ui.addProgress(this.main, 50, "Circular")

        # Indeterminate Circular, enlarge and secondary
        this.prog4 = ui.addProgress(this.main, null, "Circular,Secondary,indeterminate")
        this.prog4.circleSize = 100
Copy All       Run      

Example - Setting progress value

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

        // Add an indeterminate linear progress control to the main layout
        this.prog = ui.addProgress(this.main, 0, "Linear", 0.7)

        // Add a button control to the main layout
        this.btn = ui.addButton(this.main, "Increment")

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

    onTouch()
    {
        // Increment the value of the progress control by 10
        if( this.prog.value < 100 )
        {
            this.prog.value += 10
        }
        else
        {
            ui.showPopup( "Progress is complete!" )
        }
    }
}
class Main extends App
    onStart()
        # Creates a fullscreen layout with objects vertically centered.
        this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
        this.main.childSpacing = "Even"

        # Add an indeterminate linear progress control to the main layout
        this.prog = ui.addProgress(this.main, 0, "Linear", 0.7)

        # Add a button control to the main layout
        this.btn = ui.addButton(this.main, "Increment")

        # Add a callback handler when the button is touched
        this.btn.setOnTouch( this.onTouch )

    onTouch()
        # Increment the value of the progress control by 10
        if this.prog.value < 100 :
            this.prog.value += 10
        else:
            ui.showPopup( "Progress is complete!" )
Copy All       Run      

Properties

The following properties are available on the Progress object:

absHeightNumber
absLeftNumber
absTopNumber
absWidthNumber
backColorString
backImageString
borderNumber
borderColorString
borderStyleString
circleSizeNumber
colorString
cornerRadiusNumber
disabledBoolean
elObject
elStyleString
fontFileString
heightNumber
isVisibleBoolean
leftNumber
marginsList
opacityNumber
optionsString
paddingList
parentObject
positionObject
rotationNumber
textColorString
textSizeNumber
thicknessNumber
topNumber
typeString
valueNumber
variantString
visibilityString
widthNumber

Methods

The following methods are available on the Progress object:

getPosition( options ) → Object
gone()
hide()
setScale( x, y )
show()
Number: the initial value of the progress component.
Number: Fraction of the parent width `[0-1]`.
Number: Fraction fo the parent height `[0-1]`.
Number: The time in milliseconds.
Number: The z-index. A negative value behaves like `sendBackward` method.
Number: The z-index. A positve value behaves like `bringForward` method.
Number: Border-left thickness in pixels.
Number: Border-top thickness in pixels.
Number: Border-right thickness in pixels.
Number: Border-bottom thickness in pixels.
Number: Top-Left border radius.
Number: Top-Right border radius.
Number: Bottom-Right border radius.
Number: Bottom-Left border radius.
Number: Left margin. You can also pass string e.g. `12rem`
Number: Top margin. You can also pass string e.g. `12rem`
Number: Right margin. You can also pass string e.g. `12rem`
Number: Bottom margin. You can also pass string e.g. `12rem`
Number: Fraction of the component width.
Number: Fraction of the component height. [0-1]
Number: Fraction of the component width. [0-1]
Number: Fraction of the parent width. [0-1]
Number: Fraction of the parent height. [0-1]
Number: The x-scale of the component.Values less than `0` is smaller than the normal. While values greater than `1` is greater than the normal.
Number: The y-scale of the component. Values less than `1` is smaller than the normal. While vaues greater than `1` is greater than the normal.
String: “A comma separated options.
Theme Color: `Primary`”
, “ `Secondary`
Type: `Circular`”
, “ `Linear`
Variant: `Determinate`”
, “ `Indeterminate`”
String: “The type of animation. Here are the available values
`bounce`”
, “ `flash`”, “ `pulse`”, “ `rubberBand`”, “ `shakeX`”, “ `shakeY`”, “ `headShake`”, “ `swing`”, “ `tada`”, “ `wobble`”, “ `jello`”, “ `heartBeat`”,
Back Entrances: `backInDown`”
, “ `backInLeft`”, “ `backInRight`”, “ `backInUp`
Back Exits: `backOutDown`”
, “ `backOutLeft`”, “ `backOutRight`”, “ `backOutUp`
Bouncing Entrances: `bounceIn`”
, “ `bounceInDown`”, “ `bounceInLeft`”, “ `bounceInRight`”, “ `bounceInUp`
Bouncing exits: `bounceOut`”
, “ `bounceOutDown`”, “ `bounceOutLeft`”, “ `bounceOutRight`”, “ `bounceOutUp`
Fading entrances: `fadeIn`”
, “ `fadeInDown`”, “ `fadeInDownBig`”, “ `fadeInLeft`”, “ `fadeInLeftBig`”, “ `fadeInRight`”, “ `fadeInRightBig`”, “ `fadeInUp`”, “ `fadeInUpBig`”, “ `fadeInTopLeft`”, “ `fadeInTopRight`”, “ `fadeInBottomLeft`”, “ `fadeInBottomRight`
Fading exits: `fadeOut`”
, “ `fadeOutDown`”, “ `fadeOutDownBig`”, “ `fadeOutLeft`”, “ `fadeOutLeftBig`”, “ `fadeOutRight`”, “ `fadeOutRightBig`”, “ `fadeOutUp`”, “ `fadeOutUpBig`”, “ `fadeOutTopLeft`”, “ `fadeOutTopRight`”, “ `fadeOutBottomRight`”, “ `fadeOutBottomLeft`
Flippers: `flip`”
, “ `flipInX`”, “ `flipInY`”, “ `flipOutX`”, “ `flipOutY`
Lightspeed: `lightSpeedInRight`”
, “ `lightSpeedInLeft`”, “ `lightSpeedOutRight`”, “ `lightSpeedOutLeft`
Rotating Entrances: `rotateIn`”
, “ `rotateInDownLeft`”, “ `rotateInDownRight`”, “ `rotateInUpLeft`”, “ `rotateInUpRight`
Rotating Exits: `rotateOut`”
, “ `rotateOutDownLeft`”, “ `rotateOutDownRight`”, “ `rotateOutUpLeft`”, “ `rotateOutUpRight`
Specials: `hinge`”
, “ `jackInTheBox`”, “ `rollIn`”, “ `rollOut`
Zooming Entrances: `zoomIn`”
, “ `zoomInDown`”, “ `zoomInLeft`”, “ `zoomInRight`”, “ `zoomInUp`
Zooming Exits: `zoomOut`”
, “ `zoomOutDown`”, “ `zoomOutLeft`”, “ `zoomOutRight`”, “ `zoomOutUp`
Sliding Entrances: `slideInDown`”
, “ `slideInLeft`”, “ `slideInRight`”, “ `slideInUp`
Sliding Exits: `slideOutDown`”
, “ `slideOutLeft`”, “ `slideOutRight`”, “ `slideOutUp`”
String: “The mode of the measurements. Values can be `px` or `%`”
String: “Border color in hexadecimal format `#rrggbb`.”
String: “Border-styles. Values can be `dotted`”, “ `dashed`”, “ `solid`”, “ `double`”, “ `groove`”, “ `ridge`”, “ `inset` and `outset`. Default is `solid`”
String: “Unit of measurement. Values are `px` `rem` or `%`.”
String: “Unit of measurement.
`rem` for root em.
`px` for pixels
`%` relative to its parent dimension.
`v` relative to viewport dimension.”
String: “Unit of measurement.
`rem` for root em.
`px` for pixels
`%` relative to its parent dimensions
`v` relative to viewport dimensions.”
String: “Unit of measurment. Can be "px"”, “ "rem"”, “ "%"”, “ "v" for viewport width/height or any css supported unit.”
Object: The parent layout where to add the prgress component.
Object: The pointer event object.
function( event )
prg.absHeight
Returns the absolute height of the control in pixels.
prg.absLeft
Returns the absolute distance of the control from the left in pixels.
prg.absTop
Returns the absolute distance of the control from the top in pixels.
prg.absWidth
Returns the absolute width of the control in pixels.
prg.animate
Animate the component.
prg.backColor
A hexadecimal color of the form #rrggbb
prg.backImage
The path to your image file.
prg.border
Sets or returns the border thickness in pixels.
prg.borderColor
Sets or returns the border color. Color is in hexadecimal form #rrggbb
prg.borderStyle
Sets or returns the border style. Values can be dotted, dashed, solid, double, groove, ridge, inset and outset. Default is solid.
prg.bringForward
Bring this component forward by a given z-index.
prg.circleSize
Sets or returns the size of the circular progress control. This will assume a pixel unit.
prg.color
Sets or returns the theme color. Values can be Default Primary or Secondary
prg.cornerRadius
Sets or returns the corner radius in pixels.
prg.destroy
Destroy the component.
prg.disabled
Sets or returns the disabled state of the control.
prg.el
Returns the html container element for the control.
prg.elStyle
Sets the style of the html container element.
prg.fontFile
Sets or returns the relative path to the font-family use.
prg.getPosition
Returns the position of the component. The return object is of the form {left, top, right, bottom}
prg.gone
Destroy the component.
prg.height
Sets or returns the height of the control as a fraction of the parent control.
prg.hide
Hide the component.
prg.isVisible
Returns whether the control is visible or not.
prg.left
Returns the distance of the control from the left.
prg.margins
Sets or returns the margin of the control. Works on controls with Linear parent only. You can also pass a number to set equal margins for all sides.
prg.opacity
Sets or returns the opacity of the control.
prg.options
Sets or returns the options of the control.
prg.padding
Sets or returns the padding of the control. You can also pass a number to set equal padding for all sides.
prg.parent
Returns the parent layout control.
prg.position
Returns the position of the control. The returned object has left top right and bottom props.
prg.rotation
Sets or returns the angle of rotation in degrees.
prg.sendBackward
Bring this component backward by a given z-index.
prg.setBorder
Sets the border line for the component container.
prg.setCornerRadius
Sets the corner radius of the component.
prg.setMargins
Sets the margin of the component.
prg.setOnContextMenu
Adds a callback function on right click.
prg.setPadding
Sets the padding of the component's container.
prg.setPosition
Sets the position of the component relative to its parent dimensions.
prg.setScale
Sets the x and y scaling of the component. This will ignore the positioning and flow of controls in the layout.
prg.setSize
Sets the size of the component.
prg.show
Show the component.
prg.textColor
Sets or returns the color of the text.
prg.textSize
Sets or returns the size of the text within the control.
prg.thickness
Sets or returns the thickness of the circular stroke.
prg.top
Returns the distance of the control from the top.
prg.type
Returns the type of the control.
prg.value
Sets or returns the value of the progress control.
prg.variant
Sets or returns the variant of the progress component. Values can be Determinate or Indeterminate.
prg.visibility
Sets or returns the visibility of the control.
prg.width
Sets or returns the width of the control as a fraction of the parent control.