Control - UpdateDisplay Method

UpdateDisplay updates the display immediately

Member of Control (PRIM_CTRL)

Details

The UpdateDisplay method is used to force the control to update during a long running process. This only applies to desktop applications.
 
Updating the display when the application is busy is highly desirable to provide user feedback. However, updating a control is a relatively expensive action and it can cause significant performance issues if used incorrectly.
 
When executing under DirectX, UpdateDisplay will update ALL controls, not just the control on which it is executed.

Example

In this example, you can specify after how many iterations the update will occur.
 
The few updates, the faster the processing.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Height(139) Left(227) Top(218) Width(542) Clientwidth(526) Clientheight(100)
   Define_Com Class(#PRIM_PHBN) Name(#Start) Caption('Start') Displayposition(1) Left(88) Parent(#COM_OWNER) Tabposition(1) Top(48) Width(121)
   Define_Com Class(#PRIM_SPDT) Name(#Update) Displayposition(2) Left(88) Parent(#COM_OWNER) Showselection(False) Showselectionhilight(False) Tabposition(2) Top(8) Value(1)
   Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Update every') Displayposition(3) Ellipses(Word) Height(25) Left(8) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(8) Verticalalignment(Center) Width(81)
   Define_Com Class(#PRIM_LABL) Name(#LastExecution) Displayposition(4) Ellipses(Word) Height(25) Left(216) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(48) Verticalalignment(Center) Width(265)
 
   Evtroutine Handling(#Start.Click)
 
      Define_Com Class(#prim_time) Name(#StartTime)
      Define_Com Class(#prim_time) Name(#EndTime)
 
      #StartTime := #StartTime.Now
 
      Begin_Loop Using(#xDemoNumber) To(99999)
 
         Continue If(#xDemoNumber.Mod( #Update.Value ) <> 0)
 
         #LastExecution := #xDemoNumber.asstring
 
         #Start.updateDisplay
 
      End_Loop
 
      #EndTime := #EndTime.Now
 
      #LastExecution := ("Last execution - &1 seconds").Substitute( #EndTime.Difference( #StartTime ).asstring )
 
   Endroutine
 
   Evtroutine Handling(#Update.Changed)
 
      #Update.Value := #Update.Value.Max( 1 )
 
   Endroutine
 
End_Com

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2