Why is my PaintBox Canvas erased when my program "Not Responding"?

I wrote a small program using the Borland C ++ builder, and everything seemed fine along the way. My program has a map window and a table window, and when a user clicks a button, a lengthy process starts, which reads all the information about the map and table, and then displays it. Every time I ran it through the debugger, I had no problems. Then today I decided to test it without running it through the debugger. To my horror, the program reads in the cartographic information, and then displays it on the paintbox canvas without any problems, but when it loads the information for the grid, the map is erased !!! It looks like this happens during the table loading phase. it takes about 4 seconds, and during this time the window tells me that it is not responding. This is when the card is erased. Does anyone have any ideas aboutWhy is this happening? His driving me nuts, and I really do not understand what is happening under the hood here.

UPDATE:
I fixed the problem to some extent. I fidgeted and found this: Avoiding the "(Unresponsive)" shortcut in windows when processing large amounts of data in one piece
I added code to run once in the middle of the data read for the table. it fixed my problems. however I was wondering if anyone knows why this is so? why does my program not respond so that my canvases are erased?

+3
source share
2 answers
Marcus Junglas wrote a detailed explanation of the problem that affects both Delphi and C ++ Builder.

Delphi (, OnClick TButton), , , . .

, , , , . , . , .

, Delpi . , , Delphi , . , .

, , , .

, Application- > ProcessMessages() , .

+4

++ Builder, Delphi. , .

? . . , , .

, Delphi, . ++ Builder Image. PaintBox.

, , .

+2

Source: https://habr.com/ru/post/1759171/


All Articles