• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Display > Updating the Display

5.14. Updating the Display

Sometimes an application program needs to flush outstanding paint events.[10] For example, when a Shell is disposed of, it is hidden, exposing other Shells underneath. Paint events are queued by the operating system, and the exposed areas are drawn when the application program calls readAndDispatch(). If readAndDispatch() is called right away, the events are dispatched, and the newly exposed areas are drawn immediately. However, if the program is busy running a long operation in the user interface thread, the redraw will be delayed until the operation is finished and the thread gets back to the event loop. Until that time, the exposed areas remain unpainted.

[10] To flush outstanding paint events for a single control, see Forcing an Update in the Control Fundamentals chapter.

Typically, an application gets back to the event loop quickly so that the user will not notice the small delay. In addition, if more drawing events are created before previous ones are handled, the operating system will merge drawing events for overlapping areas into a single drawing event as an optimization. This reduces the amount of drawing that is done, gets rid of flicker, and allows the application to draw faster.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint