You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a requirement where we monitor the progress of background tasks via events. The progress bar works just fine. We have a requirement where in we also need to show the user an option to stop the background task. For this we want to show the user a prompt on the console E.g. Press X to exit: after the progress is displayed. How can this be achieved? The progress bar seems to take over and the user is not able to input anything. Below is how we expect it
0% [> ] 243/100000 (0:00:12 / 1:23:51)
Press X to exit:
If the user inputs X and presses enter the program will stop the background task and exit. Any help here would be really appreciated.
The text was updated successfully, but these errors were encountered:
You can do something like the following, which I think should work (let me know if it does not work):
progressBar.pause();
booleanexit = /* prompt the user response */;
if (exit) progressBar.close() elseprogressBar.resume();
Thanks for the quick reply. I think I did not explain the requirement correctly. The progressbar should show the progress as long as the task is running. While the progressbar is being updated continuously at some interval the user should also be shown an option to stop the background task via a prompt. Here is what I understand from your solution:
Pause the progressbar before showing the prompt to the user
Accept the input from the user
If the input matches the stop/cancel command close the progressbar
If the input does not match resume the progress
If the task is running and the user does not give any input the above solution will not show any progress and just wait. We want the progress bar to continue as long the user does not input anything.
Thanks. I now understand your request. This is unfortunately not possible right now: the constant printing of the progress bar will interfere with normal output stream. To fix this one need to track the coordinate location of the progress bar on the screen while normal text is printing -- which is difficult. It may be supported in a future version.
We have a requirement where we monitor the progress of background tasks via events. The progress bar works just fine. We have a requirement where in we also need to show the user an option to stop the background task. For this we want to show the user a prompt on the console E.g.
Press X to exit:
after the progress is displayed. How can this be achieved? The progress bar seems to take over and the user is not able to input anything. Below is how we expect itIf the user inputs X and presses enter the program will stop the background task and exit. Any help here would be really appreciated.
The text was updated successfully, but these errors were encountered: