Progress Bar

From Apache OpenOffice Wiki
Jump to: navigation, search

The progress bar control displays a growing or shrinking bar to give the user feedback during an operation, for example, the completion of a lengthy task. The minimum and the maximum progress value of the control is set by the ProgressValueMin and the ProgressValueMax properties. The progress value is controlled by the ProgressValue property. By default, the progress bar is blue, but the fill color can be changed by setting the FillColor property. The functionality of a progress bar is demonstrated in the following example:

Sub ProgressBarDemo()
	Dim oProgressBar as Object, oProgressBarModel As Object, oDialog as Object
	Dim ProgressValue As Long
	REM Dialog1 contains progress bar ProgressBar1 saved in standard library
	oDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
	REM progress bar settings
	Const ProgressValueMin = 0
	Const ProgressValueMax = 40
	Const ProgressStep = 4
	REM set minimum and maximum progress value
	oProgressBarModel = oDialog.getModel().getByName( "ProgressBar1" )
	oProgressBarModel.setPropertyValue( "ProgressValueMin", ProgressValueMin)
	oProgressBarModel.setPropertyValue( "ProgressValueMax", ProgressValueMax)
	REM show progress bar
	oDialog.setVisible( True )
	REM increase progress value every second
	For ProgressValue = ProgressValueMin To ProgressValueMax Step ProgressStep
		oProgressBarModel.setPropertyValue( "ProgressValue", ProgressValue )
		Wait 1000
	Next ProgressValue
End Sub
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages