Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thisform Gotchas! Wow!
Message
From
08/12/2000 12:40:31
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00450216
Message ID:
00450863
Views:
39
Nadya:

Here's a brief description of the dlgThermo class.


The thermometer is a form


* Modeless
* Always On top
* Automatically centered
* Has no title bar
* Has no border
* Cannot be closed
* Cannot be minimized, maximized, or resized.
* Cannot be moved

The thermometer displays


* a few shapes and lines to display the border of the
form and the border of the progress area.
* 25 dark blue rectangular shapes (shpBar1 - shpBar25) to
display progress. The FillStyle is changed to 1 (solid)
to "show" the progress bar, and 0 (transparent) to "hide"
it.
* 2 labels. The first label (lblTitle) is intended to
describe the process. The second label (lblTask) is
intended to display the current stage of the process.

For example,
lblTitle could display "Calculating election results", and
lblTask could display "Calculating Florida results..."

You can change the Caption of these labels by assiging a value
to the Title and Task custom properties. As an alternative,
you can develop a SetTitle() and SetTask() custom methods
to have the same functionality.

* 1 Esacape label (lblEscape). The label displays "Press the ESC
key to cancel this process". This label is only displayed if
the thermometer is created with the tlAllowCancel optional
parameter set to True.

For example, assume you want to display the thermometer from a
Tabulate method of a form and you want to activate the form once
the method is complete.

If you don't want the user to cancel the process, call
* loThermo = CreateObject('dlgThermo', Thisform), or
* loThermo = CreateObject('dlgThermo', Thisform)
If you want the user to be able to cancel the process, call
* loThermo = CreateObject('dlgThermo', Thisform, .T.)

Some visual elements are removed. resized, or repositioned if the user is
not allowed to cancel the process, i.e. if the thermometer was called
without the optional tlAllowCancel set to True.


Custom Properties



Abort
Logical. Specifies if the user pressed Escape to cancel.

AllowCancel
Logical. Specifies if the user is allowed to cancel the process.

CallingForm (Hidden)
Object. Stores a reference to the calling form. The calling form
is automatically activated in the Destroy event.

Interval
Numeric. Specifies the number of milliseconds to wait before
displaying a progress bar. A waiting period of about 100
milliseconds makes large progressions (from 20 to 40%) look more
natural.

Percent
Numeric. An integer between 0 and 100 representing the percentage
completed. This is the property that you will update the most often.

Task
Character. Assign a value to this property at design time or runtime
to change the caption of the lblTask label.

TimeToStop
Numeric. Specifies the number of milliseconds to wait when the
thermometer reaches a 100% state.

Title
Character. Assign a value to this property at design time or
runtime to change the caption of the lblTitle label.


Methods



Below is a short description of all methods that contain some code.

Destroy
Automatically activate the form that created the thermometer.

GetBar
Retrieves a reference to a small progress bar used to fill the
thermometer (shpBar1 - shpBar25). GetBar is called by the
Percent_Assign method.

Init
Accepts two parameters: (1) an optional reference to the form you
want to activate when the thermometer is destroyed, and (2) an
optional flag specifying if the user can press the ESCAPE key to
cancel the process. Some of the visual elements are removed,
resized, or repositioned if the user is not allowed to cancel the
process.

OnCancel
Raises the Abort flag to indicate to the controlling process
(usually a Scan .. EndScan loop) that the user wants to cancel the
process. The controlling process must verify the Abort property
and take appropriate action.

Percent_Assign
Displays/hides the small the progress bar shapes to fill the
thermometer to the specified percentage completed.

Percent_Assign uses Inkey() for two reasons: (1) recognize Escape
keys in a timely manner, and (2) display a smoother progression when
percentage jumps quickly.

Reset
Resets the custom Title, Task, and Percent properties their default
values. Reset is called from Init.

How to use the thermometer



The best way to learn is to play with it. Try the following:
loThermo =CreateObject('dlgThermo')
loThermo.Show()
loThermo.Title = 'Calculating election results'
loThermo.Task = 'Calculating Florida results...'
loThermo.Percent = 20
loThermo.Percent = 100
loThermo.Release()

In general, you will set the Title and Task property before you show the thermometer.
Previous
Reply
Map
View

Click here to load this message in the networking platform