Class XbpCrt() Foundation

Class function of the XbpCrt class.


The XbpCrt class is the GUI dialog used for applications partially programmed in text mode. An XbpCrt object provides a dialog window for text based and graphic oriented screen output. Using XbpCrt objects, applications programmed for text mode can be transitioned into pure PM applications in a stepwise manner. An XbpCrt object can display text output using functions such as QOut() or DispOut() and can display Get data entry fields (command @... SAY... GET). They can also include graphic dialog elements such as those provided by objects of the XbpPushButton and XbpMLE classes. XbpCrt objects create what are called "hybrid" applications because they combine text and graphic oriented screen output.

The XbpCrt class offers a straightforward way to transition existing text mode applications to GUI applications. An existing Clipper application can run in an XbpCrt window after being compiled with Xbase++. The program code can be changed to use Xbase Parts that provide graphic dialog elements step by step as time permits.

XbpCrt on Windows platforms

For the configuration of an XbpCrt window, the instance variable :taskList plays an important role when the window is displayed on the desktop. See the description of configuration instance variables for details.

When using MDI client windows in an application, there are some particular technical features where Windows differs from OS/2.

An MDI client window is created when an XbpCrt window receives as parent another XbpCrt window or the :drawingArea of an XbpDialog window:

If an XbpCrt window is to receive MDI client windows, it must have a menubar installed (see the method :menuBar()).
MDI client windows cannot have their own menubar.
It is not possible to create nested MDI client windows.
Class methods
Creates an instance of the XbpCrt class.

The instance variables in this group configure system resources. If changes are made to the default values, they must be made before the :create() method is executed or :configure() must be called to activate the changes.

Determines whether the dialog can be covered by other windows.
Border type for the XbpCrt window.
Determines whether the Xbase Parts in the child list are clipped during graphic output.
Determines whether the "Close" menu item in the system menu is available.
Sets the height of the font for displaying characters in the text mode.
Sets the name of the font for displaying characters in the text mode.
Sets the width of the font used to display characters in the text mode.
Restricts the movement of the window to increments of :fontWidth when the mouse is used to move the window.
The resource ID of an icon.
Specifies the input mode.
Displays pushbuttons for minimizing and maximizing the window.
Determines whether to include the system menu in the title bar of the window.
Determines whether the XbpCrt window is included as an item in the task list.
Title of the XbpCrt window
Determines whether the title bar of the XbpCrt window is displayed.
Determines whether the XbpCrt object uses a Visual Style for display.
Determines whether the window is visible after :create() is executed.
Runtime data

The instance variables in this group can be changed after :create() is called without requiring a call to :configure(). The changes are automatically registered.

Determines the display behavior of text-mode output.
Determines whether automatic focus changes are allowed.
Turn the ability to select text on or off.
Allow the user to change the font by dragging & dropping from the font manager.
Determines whether the object is a drop zone.
Specifies whether the Crt window is currently the active window.
The XbpHelpLabel object for context sensitive help.
Position of the rightmost viewable text column in an XbpCrt window.
Position of the bottom viewable text row in an XbpCrt window.
Determines whether mouse coordinates are given as graphics or text coordinates.
Specifies the result of a modal dialog.
Specifies the tooltip text to be displayed.
Enables shortcut keys for the system menu.
The width of the display area of an XbpCrt window in pixels.
The height of the display area of an XbpCrt window in pixels.
Life cycle
Requests system resources for the object.
Reconfigures the Xbase Part after :create() has been executed.
Releases the system resources of the object.
Returns the current position of the window.
Returns the current size of the XbpCrt window.
Displays the XbpCrt object as a modal dialog.
Determines the current display state of the XbpCrt window.
Returns the modal state of the window.
Specifies whether the XbpCrt object has a menu bar.
Suppresses the display of the XbpCrt window on the screen.
Returns whether an XbpCrt window is visible.
Map a point from one coordinate space to another
Installs an XbpMenubar object in the XbpCrt window.
Returns the presentation space linked to the XbpCrt window.
Sets or returns a font object used by the XbpCrt window.
Sets or returns the font "compound name".
Sets the display state of the XbpCrt window.
Defines the XbpCrt window as "modal" or "non-modal".
Defines the shape of the mouse pointer.
Switches automatic mouse pointer tracking on or off.
Repositions the XbpCrt window.
Changes the size of the XbpCrt window.
Defines a new title for the XbpCrt window.
Redisplays the XbpCrt window after it has been hidden.
Shifts the XbpCrt window to the background.
Brings the XbpCrt window to the foreground.
Mouse events

An array <aPos> containing two elements that designate the position of the mouse pointer is passed as the first parameter to virtually all mouse messages. By default, the row and column position of the mouse pointer is given in text mode {nRow,nCol} coordinates. If the value XBPCRT_MOUSEMODE_PM is assigned to the instance variable :mouseMode, the <aPos> array contains graphic mouse coordinates {nX,nY}.

:enter / xbeM_Enter
Mouse moved into Crt object.
:leave / xbeM_Leave
Mouse moved out of the Crt object.
:lbClick / xbeM_LbClick
Left mouse button clicked.
:lbDblClick / xbeM_LbDblClick
Left mouse button double clicked.
:lbDown / xbeM_LbDown
Left mouse button pressed
:lbUp / xbeM_LbUp
Left mouse button released.
:mbClick / xbeM_MbClick
Middle mouse button click.
:mbDblClick / xbeM_MbDblClick
Middle mouse button double clicked.
:mbDown / xbeM_MbDown
Middle mouse button pressed.
:mbUp / xbeM_MbUp
Middle mouse button released.
:motion / xbeM_Motion
Mouse has been moved.
:rbClick / xbeM_RbClick
Right mouse button clicked.
:rbDblClick / xbeM_RbDblClick
Right mouse button double clicked.
:rbDown / xbeM_RbDown
Right mouse button pressed.
:rbUp / xbeM_RbUp
Right mouse button released.
:wheel / xbeM_Wheel
Mouse wheel was operated.
Other events
:close / xbeP_Close
Window is being closed.
:gesture / xbeP_Gesture
A touch gesture was performed.
:helpRequest / xbeP_HelpRequest
Help has been requested.
:keyboard / xbeP_Keyboard
Keyboard input received.
:killDisplayFocus / xbeP_KillDisplayFocus
XbpCrt window is losing display focus.
:killInputFocus / xbeP_KillInputFocus
Xbase Part is losing input focus.
:move / xbeP_Move
XbpCrt window has been moved.
:quit / xbeP_Quit
Application will be terminated.
:resize / xbeP_Resize
Size of the XbpCrt window has changed.
:setDisplayFocus / xbeP_SetDisplayFocus
XbpCrt window receives the display focus.
:setInputFocus / xbeP_SetInputFocus
XbpCrt window receives input focus.
:dragEnter / xbeP_DragEnter
Item has been dragged over a drop zone.
:dragMotion / xbeP_DragMotion
Item is being dragged inside a drop zone.
:dragLeave / xbeP_DragLeave
Item has been moved outside a drop zone.
:dragDrop / xbeP_DragDrop
Item has been dropped over a drop zone.
MDI application using XbpCrt windows
// In the example, two windows are created that are 
// visible only within the parent window. After the focus 
// changes due to a mouse click, the display focus is changed 
// and the output of the function QOut() occurs in the 
// window that currently has focus. 

#include "" 

   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL bSetFocus, bKillFocus 

   bSetFocus  := {|mp1,mp2,obj| ; 
                   QOut( obj:title, "received focus"), ; 
                   SetAppWindow( obj ) } 

   bKillFocus :=  {|mp1,mp2,obj| ; 
                   QOut( obj:title, "lost focus") } 

   oXbp := SetAppWindow()           // Parent window 
   oXbp:setTitle( "Parent" ) 
   oXbp:setInputFocus  := bSetFocus 
   oXbp:killInputFocus := bKillFocus 

   oXbp := XbpCrt():new( ,, {50, 100}, 10, 40, "Child A" ) 
   oXbp:autoFocus := .F.            // First child window 
   oXbp:setInputFocus  := bSetFocus 
   oXbp:killInputFocus := bKillFocus 

   oXbp := XbpCrt():new( ,, {300, 70}, 15, 35, "Child B" ) 
   oXbp:autoFocus := .F.            // Second child window 
   oXbp:setInputFocus  := bSetFocus 
   oXbp:killInputFocus := bKillFocus 

   nEvent := 0 
   DO WHILE nEvent <> xbeP_Close    // Event loop 
      nEvent := AppEvent( @mp1, @mp2, @oXbp, 0 ) 

      IF nEvent == xbeK_ESC         // Esc terminates 
      ELSEIF nEvent < xbeB_Event    // output in window with focus 
         ? "The key has the event code:", nEvent 
      ELSEIF oXbp <> NIL 
         oXbp:handleEvent( nEvent, mp1, mp2, oXbp ) 

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.