AppProgressDialog¶
AppProgressDialog creates a dialog box with a progress control and a Cancel button.
-
bool = AppProgressDialog()
-
bool = AppProgressDialog(nUpper)
-
bool = AppProgressDialog(nUpper, ssTitle)
Return Value
If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0).
Parameters
-
nUpper
Default value is 100.
-
ssTitle
Default value “Progress”.
Comment
Above the progress control a text control with two lines is displayed. The text can be set with the AppSetStatusBarText after the control has been created.
Beginning with UniPlot R2015.8 calls of AppProgressDialog and AppProgressCreate can be nested.
Example: If you have a function that displays the progress for the import of a data file and you want to invoke this function for 5 data files and show the overall progress in the progress bar, 20 % of the progress of each date file will be displayed in the progress bar. See example.
Example
def SubAppProgressDialog()
{
nStep = 10;
AppProgressDialog(nStep);
for (i in 1:nStep) {
AppSetStatusBarText(sprintf("Step: %d", i));
bRet = AppProgressStepIt();
if (!bRet) {
return FALSE; // cancel
}
AppSleep(50); // Simulate some work
}
AppProgressDestroy();
return TRUE;
}
def TestAppProgressDialog()
{
nStep = 5
AppProgressDialog(nStep, "Import Data");
for (i in 1:nStep) {
bRet = SubAppProgressDialog();
if (!bRet) {
return FALSE; // cancel
}
bRet = AppProgressStepIt();
if (!bRet) {
return FALSE; // cancel
}
AppSetStatusBarText(sprintf("Step: %d", i));
AppSleep(50); // Simulate some work
}
AppProgressDestroy()
}
TestAppProgressDialog()
TestAppProgressDialog()
History
Version | Description |
---|---|
R2015.8 | Progress bar with stack support. |
R2012.1 (5.40.1) | New. |
See also
Overview Application Object, AppProgressStepIt, AppProgressDestroy, AppProgressCreate, ShowWaitCursor, AppSetStatusBarText
id-796429