Update_Display

Functions

HC_BOOLEAN Update_Display (void)
 Makes sure that external appearances are up-to-date with respect to the internal definitions. More...
 

Detailed Description

Function Documentation

◆ Update_Display()

HC_BOOLEAN Update_Display ( void  )

Makes sure that external appearances are up-to-date with respect to the internal definitions.

Returns
status - Flag indicating whether or not HOOPS completed drawing the scene in the last update. A (1) indicates it did draw the complete scene, while a (0) indicates that the previous update was aborted before completion, due to a call to IM function HIC_Abort_Update.

DETAILS

For the sake of efficiency, the system normally accumulates picture changes without displaying them as they happen. The system gets the screen back in synch with the inside world whenever user input is requested through HOOPS (by calling Await_Event() , Pause(), or any Get routine such as Get_Button() ). You can force a repaint by calling Update_Display() .
However, it is seldom necessary to call Update_Display() from within an application. In fact, it might cause your program to do unnecessary work by erasing and repainting windows twice.
Possible situations that may require this feature include the following:
1) If your program generates a single picture and exits without waiting for any event at all. In this case, you should put a call to Pause() rather than Update_Display() at the end of your program—this will handle displays where program exit clears the display, and, on the other hand, will work the same as Update Display if you're driving a plotter.

2) If you request user input outside of the graphics system, or if your program goes into a long calculation, you might want to first make sure the display is accurate. If you do go into a long calculation, it would be user-friendly to allow the user to abort the calculation. Also, if you find yourself requesting keyboard input outside the graphics system, you should consider a Get_String() followed by a "Read" or "sscanf" that operates on the characters returned from HOOPS.

3) If you want to "flash" something on the screen—for example, to confirm a menu selection by flashing the color briefly—it might be convenient to call Update_Display() to get the first color change to happen, then let the regular input loop put it back. However, if your program is run on a really fast machine you might not be able to see the flash at all. A short Get_Wakeup() would work more reliably and would do the Update for you. (This would also let you "tune" the length of the flash.) The sequence would be Set Color – Get Wakeup – UnSet Color – do work – get regular input. The button will stay lit at least as long as the Wakeup, and will go out when you do the "get regular input".

4) If you are animating a scene you might want to Update without checking for user input. ("Animation" occurs whenever the picture on the screen is intended to go through a smoothly occurring uninterrupted sequence of changes.) Again, if you want it to be portable, use a Wakeup to space out the frames, and remove the explicit Update.

5) Lastly, if you have a complex scene that is going to take a long time to build, you might want to let the user see the picture as it's being built. To do this you would call Update_Display() at intervals during the building process.

NOTES

Updating will cause any "Disable Event" requests left over from a call to Get_Location() or Get_Selection() to take effect. This will cause the screen cursor to disappear (at least momentarily, until the next "Get" request) and any user actions that happen in the interim to be missed. The missing cursor can be a useful indicator (that your program's gone away), but the missing actions can be confusing.
If you want your input device to run smoothly despite calls to Update_Display() , insert an extra call to Enable_Location_Events() or Enable_Selection_Events() near the beginning of your program. (The call should have the parameters described in Get_Location() and Get_Selection() ).
If external appearances are already "up-to-date", Update_Display() does nothing.
Updates are always legal. There is no need to close the open segment(s), for example, before Updating the screen.
The "display" in question is the HOOPS display appearing on all initialized devices.

RESTRICTIONS

See also
Reset_System, Set_Driver_Options, Set_Heuristics, Await_Event, Check_For_Events, Get_Selection, Get_Wakeup.