Largest Provider of Commercial Smalltalk
Cincom is one of the largest commercial providers of Smalltalk, with twice as many customers and partners as other commercial providers.

Tom Nies

Get Started

Cincom ObjectStudio’s ProgressBarDialog

Posted on in Categories ObjectStudio, Smalltalk

Benefits

  • No more primitives—100% Smalltalk code.
  • The code can be changed at any time.
  • Easier for support to send fixes to customers.
  • Customers can now overwrite or change the code to their liking.
  • Easy enhancements of features not yet implemented.

ProgressBarDialog

The ProgressBarDialog has more or less the same purpose as the MarqueeDialog we discussed last time.  It shows some simple animation while a larger process is being performed and the systems seem to be idle. However, with the ProgressBarDialog, we have a clear set of steps and we can show how the process is proceeding and how much of it is already processed.

This is what a typical ProgressBarDialog looks like that has two-thirds of the job finished.

Using this ProgressBarDialog in your application is very similar to using the MarqueeDialog.

Protocol

To create a new ProgressBarDialog, you have the option of the following two methods:

createTitle: aString or createTitle: aString position: aPosition extent: anExtent in which aPosition and anExtent are Point objects.

When you use “ProgressBarDialog createTitle: ‘Loading Information …’”, you create a dialog that will appear at position 225@475 and with a size of 1160@350. It will look like this:

By using “ProgressBarDialog createTitle: ‘Loading Information …’ position: 400@800 extent: 1300@250,” you define where you want the dialog and the size of it. In this case, you get:

setRangeLower:upper:

With the setRangeLower:upper:, you specify the starting and ending range of the progress bar for instance:

progressBar setRangeLower: 0 upper: myCollectionSize.

step:

The step: method tells the progress bar how much it should proceed after each step of the process is executed.

progressBar step: 1.

open

opens the progress bar dialog.

stepIt

sending stepIt to the progress bar increments the progress of the bar with the quantity defined with the step: method.

close

closes the progress bar dialog.

Example

| coll dialog |
coll := self doSomeWorkAndReturnACollection.
dialog := ProgressBarDialog createTitle: ‘Work in progress…’.
dialog
 setRangeLower: 0 upper: coll size;
step: 1.
dialog open.
coll do: [:each |
            dialog stepIt.
            self doSomeWorkUsing: each
].
dialog close.