ProgressBar
This function creates a progressbar widget. A progressbar displays the progress of a task that is being performed.
You can set the script float value
progress to adjust the displayed progress.
Syntax
- global Widget ProgressBar(number x, number y, number width, number height, Widget parent)
Parameters
- x: X position of the widget, in logical units.
- y: Y position of the widget, in logical units.
- width: width of the widget, in logical units.
- height: height of the widget, in logical units.
Returns
Returns a new progressbar.
Example
local window = Window:Create()
local context = Context:Create(window)
local gui = GUI:Create(context)
local base = gui:GetBase()
base:SetScript("Scripts/GUI/Panel.lua")
x=20
y=20
local sep=20
widget = Widget:Label("Progress:",x,y,300,14,base)
y=y+sep
widget = Widget:ProgressBar(x,y,300,14,base)
widget:SetFloat("progress",0.6)
y=y+sep
while true do
if window:Closed() then return end
if window:KeyHit(Key.Escape) then return end
while EventQueue:Peek() do
local event = EventQueue:Wait()
if event.id == Event.WidgetAction then
System:Print("WidgetAction")
elseif event.id == Event.WidgetSelect then
System:Print("WidgetSelect")
end
end
context:Sync()
end