Open shirishpandharikar opened 2 years ago
You can do something like the following, which I think should work (let me know if it does not work):
progressBar.pause();
boolean exit = /* prompt the user response */;
if (exit) progressBar.close() else progressBar.resume();
You can do something like the following, which I think should work (let me know if it does not work):
progressBar.pause(); boolean exit = /* prompt the user response */; if (exit) progressBar.close() else progressBar.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:
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.