Programming Guide:xppguide

The intelligent presentation space - XbpCrt:presSpace() Foundation

An XbpCrt window is created in the AppSys() procedure as the default application window. It provides the Xbase++ hybrid mode where text-oriented and graphic screen output can be combined. This is the easiest way to develop programs for GUI.

As a special feature, the XbpCrt window already has a presentation space and serves as device context for it. An XbpCrt window forms a unit with its presentation space and thus allows easiest possible usage of the GraphicsEngine. The :presSpace() method of an XbpCrt window returns its presentation space. This method exists only in the XbpCrt class. As long as the application window is an XbpCrt window, Gra..() functions may be called without passing a presentation space as the first parameter, since it defaults to SetAppWindow():presSpace().

Besides of providing the default presentation space, an XbpCrt window has some inbuilt intelligence which encapsulates complexities of the GUI that a programmer normally has to deal with. The presentation space of an XbpCrt 'remembers' what is currently displayed in the window. It buffers graphic output. This intelligence becomes obvious when an XbpCrt window is covered temporarily by another window and then brought back into the foreground. In this case, the covered part of the XbpCrt window must be refreshed or repainted, respectively. To repaint itself, a window receives the xbeP_Paint event from the operating system. It is normally a programmer's task to implement code for a window's repaint. This is not the case with XbpCrt windows. It processes xbeP_Paint messages on its own and causes its presentation space to redisplay lost parts of the window's contents.

Due to its inbuilt intelligence, the presentation space of an XbpCrt window guarantees all visible output to be redisplayed when the XbpCrt window is covered temporarily and brought into the foreground again. Assume the following line of code:

GraLine( , {0,0}, {640,400} ) 

This call to the GraLine() function draws a line, diagonal from the lower left to the upper right corner. It remains visible even if other windows are clicked to the forground temporarily. The line is redisplayed when the XbpCrt window regains focus, and no code must be implemented to process the xbeP_Paint event.


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.