xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DispBegin()

Initiates buffering of console window output.

Syntax

DispBegin() --> NIL

Return

The return value is always NIL.

Description

The DispBegin() function is used to buffer a series of commands and/or functions that produce output on the the screen (console window). The display becomes visible when DispEnd() is called.

DispBegin() starts collecting screen output in an internal buffer so that complex output can be produced in a series of function calls. The result of individual function is not displayed, only the entire screen buffer is made visible when DispEnd() is called. Buffered screen output can result in a considerable performance increase.

Note that DispBegin() calls can be nested, i.e. DispBegin() can be called repeatedly without calling DispEnd(). To make the buffered display visible, however, DispEnd() must be called as many times as DispBegin() is called. Buffered screen output becomes only visible after a matching number of DispEnd() calls.

The number of pending DispEnd() calls can be obtained from function DispCount().

Info

See also:DispCount(), DispEnd(), DispOut()
Category: Screen functions
Source:rtl\gt.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example uses buffered screen output to give the impression of
// a box moving behind another box that stays in front.

   #include "Box.ch"

   PROCEDURE Main
      LOCAL cFront, nT:= 0, nL:= 0, nB:= 3, nR:= 30

      CLS

      // display initial box in front
      DispBox( 8, 12, 18, 52, B_SINGLE+" ", "W+/B" )
      DispOut( "I am in front" )

      DO WHILE nT < 22

         // buffered screen output displays second box
         // behind box in front.
         DispBegin()

         cFront := SaveScreen(8,12,18,52)
         DispBox( nT, nL, nB, nR, B_DOUBLE+" ", "N/W*")
         DispOut( "I am moving behind a box" )
         RestScreen( 8, 12, 18, 52, cFront )

         DispEnd()

         Inkey(0.1)

         // buffered screen output erases moving box
         DispBegin()
         Scroll( nT, nL, nB, nR )
         RestScreen( 8, 12, 18, 52, cFront )
         DispEnd()

         // new coordinates for moving box
         nT++ ; nL++ ; nB++ ; nR++
      ENDDO

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe