UpdateDisplay

LANSA Version 13 SP2

UpdateDisplay


In Win32 the UpdateDisplay method could be called on a control to force the screen to refresh during a long running process. The Win32 runtime was able to address individual controls specifically and in effect could update a small portion of the UI.

However, the DirectX runtime works in a different manner and this is no longer possible. UpdateDisplay will cause the whole of the form to update.

In most circumstances this will be of little consequence. However, in situations where UpdateDisplay is called repeatedly, this will cause noticeable performance degradation.

A typical situation where that occurs is when a Progress Bar is used. Progress Bars automatically use UpdateDisplay to ensure that they reflect their latest value. In the example below a simple loop is executed and the progress bar and start button caption are updated every iteration.

In Win32 above, the start button is not updated. The UpdateDisplay is specific to the Progress Bar. However, in DirectX, the whole form gets updated.


The code for this form is available in the Sample Source section of this document.

To counteract this situation, rather than updating the progress bar or specifically executing UpdateDisplay every iteration, a simple test can be added so that the update only occurs every 10th time.