JVCL Help:TJvProgressDialog

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Class Hierarchy

TJvProgressDialog
run\JvProgressDialog.pas


Summary

A component that can display a progress dialog either modally or non-modally.

run\JvProgressDialog.pas


Pascal

 run\JvProgressDialog.pas
 TJvProgressDialog = class(TJvCommonDialogF);


Description

  1. JVCLInfo

Use a TJvProgressDialog when you need to display a progress dialog in your application. Progress dialogs are mostly used to provide feedback to the user when the application is performing a lengthy process and the program needs to be disabled until finished.
Depending on your needs, the dialog can be shown either modally or non-modally. When shown modally, the message loop of the program is actually taken over by the dialog and thus your program might not be able to perform its intended work (unless it is done in a separate thread). For example, the following code would not work when displaying the dialog modally.
JvProgressDialog1.ShowModal; DoLengthyProcess; Because of the message loop being taken over by the dialog, the DoLengthyProcess method won't be called until the dialog is closed. When displaying the dialog modally, you must perform the processing in the OnProgress event instead.
When displaying the dialog non-modally, you don't need to have an OnProgress event handler (actually, it isn't even called in this case). Instead you can update the components properties directly while performing the process.
// set up the dialog:
JvProgressDialog1.Min := 0;
JvProgressDialog1.Max := Count - 1;
JvProgressDialog1.Position := 0;
JvProgressDialog1.Text := 'Processing items, please wait...';
JvProgressDialog1.Show;
for i := 0 to Count - 1 do
begin

 DoProcess(Items[i]);
if i mod 10 = 0 then// only update display every 10'th item
JvProgressDialog1.Position := i;
end;

JvProgressDialog1.Hide;

run\JvProgressDialog.pas


About

Navigation

run\JvProgressDialog.pas


Notes

During execution of the dialog, the component properties reflects the current values in the dialog (as changed in OnProgress or by direct assignment). After execution, the properties are reset to their original values.

run\JvProgressDialog.pas


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page