Dec 232017
 
PdoxWin example for a progress percent bar.
File PCTBAR.ZIP from The Programmer’s Corner in
Category Recently Uploaded Files
PdoxWin example for a progress percent bar.
File Name File Size Zip Size Zip Type
PCT_DEMO.FSL 25696 7625 deflated
README.TXT 5309 2396 deflated

Download File PCTBAR.ZIP Here

Contents of the README.TXT file


Welcome to PCT_DEMO.ZIP!

INTRODUCTION
------------

This .ZIP file contains a Paradox for Windows (1.0) form that
demonstrates a technique for implementing "progress bars" in ObjectPAL.
(A progress bar shows the "percent completed" of a task in progress, like
the one that appears in the PFW title screen.)

The file itself contains three different progress bars:

- A horizontal "3D" bar that uses frame styles to indicate progress

- A horizontal colored bar, using the colors in the PFW title screen

- A vertical "thermometor"

Each progress bar displays the percent complete somewhere in the bar.


WORKING WITH THE DEMO
---------------------

To open and play with the demo, change your working directory to the
directory containing the form (PCT_DEMO.FSL), then choose File | Open |
Form (or click the Open Form SpeedBar button on the Desktop).

The Scroll Increment panel lets you choose an interval to "scroll" the
progress bars.

The Scroll Bars button scrolls the bars, using the increment set in the
Scroll Increment panel.

The Enter Value button sets the bars to the percentage value you enter
in the dialog box that appears when you click the button.

The Exit button does just that; it exits (and closes) the form.

There's also a credits screen, but I'm not going to tell you where it
is. (It's easy to find, especially since the form is not delivered.)


TROUBLESHOOTING
---------------

If you have troubles displaying the form, make sure you have the default
Windows 3.1 TrueType fonts installed and that Control Panel is set so it
uses TrueType fonts in windows. (The form itself only uses System and
Arial fonts, so there shouldn't be too many problems.)


HOW IT WORKS
------------

Each progress bar contains two rectangles. One is displayed when the bar
is "empty", the other appears as the bar "fills." To control the display
of the "fill" rectangle, each progress bar contains a custom method,
called setMeter, that determines the size of the "empty" bar (called
Limit), calculates the number of twips the "fill" bar (called Meter)
needs to grow to fill the percentage, and resizes Meter so it covers
the required amount of Limit.

By calling setMeter at various intervals, you can fill the bar between
ObjectPAL operations.

To call setMeter, you need to pass it a Number. For example:

Meter_1.setMeter(50) ; sets the bar to 50%
Meter_2.setMeter(0) ; sets the bar to 0%
Meter_3.setMeter(100) ; fills the bar

For more examples, see the pushButton methods of Scroll and Value buttons.


ADDING METERS TO YOUR OWN APPS
------------------------------

To add one of these percentage meters to your own apps, simply copy the
container (Meter_x) to the ClipBoard, and then paste it into an
appropriate container on your form.

You can resize the meter, but make sure you resize Meter, Limit, and
(for the horizontal meters) Display. These objects should be the same
size. If you resize the meter, you don't have to worry about the code;
it should work with the new size without problems. (At least it did
when I was refining the form design.)

Pay particular attention to the properties of the various objects
comprising a meter. If you change the containership model, you'll
need to modify the code.

The key to making these meters flow correctly is knowing when to call
setMeter. If you have several time-consuming operations, call setMeter
at relatively "equal" intervals, so the "animation" appears smooth.


REVISION HISTORY
----------------

12 February 1993: Release 1.0 uploaded to CompuServe's PDOXWIN forum.


DISCLAIMER
----------

This code is not guaranteed to be suitable for anything. I'll accept
no responsibility for how it's used or the consequences of that use.
I developed this form to discover the technique for myself and, to that
end, am satisfied with it. If you find it is not useful, delete it.
I'll listen to suggestions and comments, but reserve the right to not
act on them.

If you happen to find a bug, let me know. I may fix it. (Then again,
I may not.) I am generally polite and love to help, but please be
reasonable.

You can distribute this code, within the limits of CompuServe's
policies. If you publish this technique or use it in a commercial
product, I would appreciate an acknowledgement.

To contact me, you can post a message to PDOXWIN or send me a private
message via CompuServe MAIL.

Hope this helps...

Lance Leonard (76117,3050)


BONUS DEMO
----------

The Exit button is a rectangle containing two graphics and ObjectPAL code
to make the button look and behave like the 3D buttons found in PFW dialog
boxes (also known as BWCC buttons.)

The pushButton method attached to this "button" is a custom method I
added, using the Methods dialog box. It didn't appear in the built-in
methods list until after it was added.

More examples of this particular technique will be forthcoming. If you
want to experiment with it before I finish my work, paste both bitmaps
into PaintBrush and compare them.

(Special thanks to Randy Magruder and Bob Lenarcik for their initial
work with the 3D button technique.)


 December 23, 2017  Add comments

Leave a Reply