grandMA3 User Manual Publication

Progress Bar

grandMA3 User Manual » Plugins » Interface Functions » Progress Bar
Version 2.2

The Progress Bar is a Lua function that can create a moving progress bar on the screens.

There are several Lua functions that are connected to creating and running a progress bar. See links to the topics below the example.

Example

This example uses all the progress bar functions:

Lua
return function()
    -- create the progress bar
    local progressBarHandle = StartProgress("myProgressTitle")

    -- set start index and end index of the progress bar
    local progressRangeStart, progressRangeEnd = 1, 10

    -- Define the range of the progress bar
    SetProgressRange(progressBarHandle, progressRangeStart, progressRangeEnd)
    -- Define the text of the progress bar
    SetProgressText(progressBarHandle, "This is my ProgressBar Text")
    -- Set the progress bar value to the start of range
    SetProgress(progressBarHandle, progressRangeStart)

    -- Loop that goes through the progress bar
    for i = progressRangeStart, progressRangeEnd do
        -- Add a yield to allow other functions and delay the progress
        coroutine.yield(1)
        -- Increment the progress state of the progress bar
        IncProgress(progressBarHandle, 1)
    end

    -- remove the progress bar:
    StopProgress(progressBarHandle)

end

Related Functions