FabGL
ESP32 Display Controller and Graphics Library

◆ progressBox()

InputResult progressBox ( char const *  titleText,
char const *  buttonCancelText,
bool  hasProgressBar,
int  width,
Func  execFunc 
)
inline

Shows a dialog with a label and a progress bar, updated dynamically by a user function.

Parameters
titleTextOptional title of the dialog (nullptr = the dialogs hasn't a title)
buttonCancelTextOptional text for CANCEL button (nullptr = hasn't CANCEL button)
hasProgressBarIf true a progress bar is shown
widthWidth in pixels of the dialog
execFuncA lambda function which updates the text and the progress bar calling the parameter object's update() function
Returns
Dialog box result (Cancel or Enter)

Example:

InputBox ib;
ib.begin();
auto r = ib.progressBox("This is the title", "Abort", true, 200, [&](fabgl::ProgressForm * form) {
  for (int i = 0; i <= 100; ++i) {
    if (!form->update(i, "Index is %d/100", i))
      break;
    delay(100);
  }
});
if (r == InputResult::Cancel)
  ib.message("", "Operation Aborted");
ib.end();

Definition at line 619 of file inputbox.h.