SDK:Progress Dialog

From Vectorworks Developer
Jump to navigation Jump to search

The class VWFC::Tools::CProgressDlg is designed so Start and End define one loop of work and DoYield must be called on each iteration (internal times will make sure it doesn't spend too much time)

The VectorScript call VS:ProgressDlgOpen uses this class.

Note: The infinite progress dialog doesn't require Start and End, just DoYield to let the messages go through for the animation

Example:

using namespace VWFC::Tools;
CProgressDlg	progressDlg;
progressDlg.Open( "title" );
progressDlg.SetTopText( "something if needed" );
progressDlg.SetBottomText( "something if needed" );
progressDlg.SetMeterText( "something if needed" );

progressDlg.Start( 40, 100 );	// 40% of the work will be done in 100 loops
for(size_t i=0; i<100; ++i)
{
	...
	progressDlg.DoYield();
}
progressDlg.End();

progressDlg.Start( 60, 12 );	// 60% of the work will be done in 12 loops
for(size_t i=0; i<12; ++i)
{
	...
	progressDlg.DoYield();
}
progressDlg.End();

progressDlg.Close();