Change ProgressBar to "indeterminate" state
Posted: Fri Mar 11, 2011 10:03 pm
If you need an activity indicator for example when performing an action
which duration is not known, Windows offers a #PBS_MARQUEE flag for
the ProgressBarGadget which srod nicely demonstrated with a code by
Sparkie:
http://www.purebasic.fr/english/viewtop ... 31&start=3
The Carbon API of MacOS X offers something similar - a so called
"indeterminate" state for the ProgressBarGadget. The following example
code demonstrates it. By pressing the toggle button you can toggle
between the normal appearance of the progress bar and the indeterminate
state:
which duration is not known, Windows offers a #PBS_MARQUEE flag for
the ProgressBarGadget which srod nicely demonstrated with a code by
Sparkie:
http://www.purebasic.fr/english/viewtop ... 31&start=3
The Carbon API of MacOS X offers something similar - a so called
"indeterminate" state for the ProgressBarGadget. The following example
code demonstrates it. By pressing the toggle button you can toggle
between the normal appearance of the progress bar and the indeterminate
state:
Code: Select all
ImportC ""
SetControlData(Control.L, ControlPartCode.L, TagName.L, BufferSize.L, *Buffer)
EndImport
#kControlProgressBarIndeterminateTag = 'inde'
#kControlEntireControl = 0
OpenWindow(0, 0, 0, 220, 60, "ProgressBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ProgressBarGadget(0, 5, 10, WindowWidth(0) - 10, 20, 0, 10)
SetGadgetState(0, 5)
ButtonGadget(1, 5, 30, WindowWidth(0) - 10, 22, "Toggle progress indicator")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 1
State ! 1
SetControlData(GadgetID(0), #kControlEntireControl, #kControlProgressBarIndeterminateTag, SizeOf(State), @State)
EndIf
EndSelect
ForEver