Using a canvas when the program is busy

If I draw a canvas with an histogram inside and I do some tasks, like cout, cin, … on the terminal I can’t use the canvas (and if some windows cover the canvas, the canvas become all white). I need to see the histogram plotted in the canvas while the program is waiting for input by cin.

You must call
in strategic places in your code (in a loop, etc)


ok, but my problem is quite different. The probram is not busy because it’s calculating, but it is wating for an input (std::cin). The user to write the correct input needs to see at the plotted histogram, zooming it, … but it is impossibile.

call mycanvas.Update(); before reading your numbers


My guess you are speaking about MS Windows application.
On UNIX you should activate the the “backing store” of your X server.

The "Windows " solution is to use the GUI “dialog” to enter what you want instead of the console mode.

Another approach is to create a dedicated console input thread … but I one needs some strong reason introducing threads. I believe GUI solution is simpler.