Function DispCount() Foundation
Determines the number of pending DispEnd() calls.
DispCount() --> nDispendCount
DispCount() returns an integer numeric value. This designates the number of DispEnd() calls required to display all screen buffers.
The number of screen buffers is determined with DispCount(). A screen buffer is only displayed after DispEnd().
Each call to DispBegin() opens a new screen buffer. Any output to the screen is stored in the buffer until a corresponding call to DispEnd() occurs. Only then is the display visible on the screen.
DispCount() determines how many screen buffers still exist which have not yet been displayed. This is especially important when calls to the function DispBegin() are nested and a runtime error is generated from which the error handling routine can recover. In this case, all screen buffers must be displayed before any new output on the screen is possible.
// In the first part of the program nested calls to
// DispBegin() occur. The program waits for a keypress
// before DispEnd() so that the screen output can occur.
// The program lapse makes it possible to read the
// cursor position before DispEnd().
// In the second part of the program the same nested calls
// to DispBegin() occur. Here a runtime error is generated
// by an uninitialized variable. The error handling occurs
// after RECOVER and displays all screen buffers.
PROCEDURE Main
LOCAL bError
CLS
bError := ErrorBlock( {|e| Break(e)} )
BEGIN SEQUENCE
*******************
*** First part ***
*******************
@ 0,0 SAY "Start of the screen buffering, press key"
DispBegin()
@ 1,0 SAY "DispBegin() Step 1: "
QQOut("dispcount() is:", DispCount() )
DispBegin()
@ 2,0 SAY "DispBegin() Step 2: "
QQOut("dispcount() is:", DispCount() )
Inkey(0)
DispEnd()
@ 3,0 SAY "DispEnd() Step 2: "
QQOut("dispcount() is:", DispCount() )
Inkey(0)
DispEnd()
@ 4,0 SAY "DispEnd() Step 1: "
QQOut("dispcount() is:", DispCount() )
***************************************
*** Second part with runtime error ***
***************************************
@ 6,0 SAY "Start of the screen buffering with error, "+;
"press key"
DispBegin()
@ 7,0 SAY "DispBegin() Step 1: "
QQOut("dispcount() is:", DispCount() )
DispBegin()
@ 8,0 SAY "DispBegin() Step 2: "
QQOut("dispcount() is:", DispCount() )
QQOut("Runtime error:", cRuntimeError )
DispEnd() // create runtime error
@ 9,0 SAY "DispEnd() Step 1"
QQOut("dispcount() is:", DispCount() )
DispEnd()
RECOVER // error handling
ErrorBlock(bError)
@ 10,0 SAY "Error handling: " // sound warning tone
QQOut("dispcount() is:", DispCount(), Chr(7) )
Inkey(0)
DO WHILE DispCount() > 0 // display all
DispEnd() // screen buffers
ENDDO
ENDSEQUENCE
ErrorBlock(bError)
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.