|Powered by QM on a Rpi server|
KnowledgeBase 00066: Save/Restore Screen Data
This article was originally published as a Tip of the Week.
When using a QMConsole session on Windows or the AccuTerm terminal emulator on all platforms, QM provides a way to save a rectangular area of the screen image that can subsequently be restored. This makes it very easy to construct menus or pop-up boxes without destroying previously displayed data.
Saving Screen Data
The function to save a rectangular area of the screen image is
var = SAVE.SCREEN(col, line, width, height)where col and line identify the top left corner of the region to be saved and width and height specify the size of the region.
Note that when using AccuTerm, the data is not sent over the network but is stored internally by AccuTerm. The QMBasic variable holds a reference to this data, not the actual data. This results in best performance when saving large areas of text.
The statement to restore previously stored data is
RESTORE.SCREEN var, restore.statewhere restore.state is a Boolean value that determines whether the cursor position, pagination mode and current display attributes are to be restored from the saved data.
Saved screen data can be restored any number of times. The saved screen region will persist until the associated variable is overwritten or discarded (e.g. on program termination). The data saved within the terminal emulator will be automatically discarded at this time.
AccuTerm Terminal Types
Use of this capability requires that the terminfo sreg and rreg items are correctly defined. These are present in the terminal definitions with the -at suffix (e.g. vt100-at).