gtk-sharpGtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Gtk.WidgetGtk.IOrientableA widget which indicates progress visually.The is typically used to display the progress of a long running operation.
It provides a visual clue that processing is underway.
The can be used in two different modes: percentage mode and activity mode.When an application can determine how much work needs to take place (e.g. read a fixed number of bytes from a file) and can monitor its progress,
it can use the in percentage mode and the user sees a growing bar indicating the percentage of the work that has been completed.
In this mode, the application is required to set periodically to update the progress bar.When an application has no accurate way of knowing the amount of work to do, it can use the in activity mode, which shows activity by a block moving back and forth within the progress area.
In this mode, the application is required to call perodically to update the progress bar.There is quite a bit of flexibility provided to control the appearance of the .
Functions are provided to control the orientation of the bar, optional text can be displayed along with the bar, and the step size used in activity mode can be set.
The following example show how percentage mode works
using System;
using Gtk;
namespace TestGtkAlone
{
public class TestProgress
{
static Gtk.ProgressBar PBar;
static void Main()
{
Gtk.Application.Init();
Gtk.Window WinPBar = new Window("Test Progress bar - Percentage mode");
Gtk.HBox HContainer = new Gtk.HBox(false, 2);
PBar = new ProgressBar();
Gtk.Button ButtonStart = new Gtk.Button("Start Progress");
HContainer.Add(PBar);
HContainer.Add(ButtonStart);
ButtonStart.Clicked += new EventHandler(ButtonStart_Clicked);
WinPBar.Add(HContainer);
WinPBar.ShowAll();
Gtk.Application.Run();
}
public static void ButtonStart_Clicked(object sender, EventArgs args)
{
PBar.Adjustment.Lower = 0;
PBar.Adjustment.Upper = 1000;
while (PBar.Adjustment.Value < PBar.Adjustment.Upper) {
PBar.Adjustment.Value+=1;
}
}
}
}
ConstructorCreates a new .Creates a new .Constructor
Pointer to the C object.
Internal constructorThis is an internal constructor, and should not be used by user code.PropertyGLib.Property("ellipsize")Pango.EllipsizeModeTo be addeda To be addedPropertyGLib.Property("fraction")System.DoubleThe current fraction of the task that has been completed.an object of type The current fraction of the task that has been completed.PropertyGLib.GTypeGType Property.a Returns the native value for .PropertyGLib.Property("inverted")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("orientation")Gtk.OrientationThe current orientation.an object of type The current orientation.MethodSystem.VoidIndicates an unknown amount of progress has been madeIndicates that some progress has been made, but you don't know how much.
This causes the to enter "activity mode," where a block bounces back and forth.
Each call to causes the block to move by a little bit (the amount of movement per pulse is determined by ).PropertyGLib.Property("pulse-step")System.DoubleThe fraction of total length to move the bouncing block for each call to .an object of type The fraction of total length to move the bouncing block for each call to .PropertyGLib.Property("show-text")System.BooleanTo be added.To be added.To be added.PropertyGLib.Property("text")System.StringThe text displayed superimposed on the .an object of type The text displayed superimposed on the , if any, otherwise .
The return value is a reference to the text, not a copy of it, so will become invalid if you change the text in the .