Classes

Class XbpCrt() Foundation

Class function of the XbpCrt class.

Superclass
Description

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
:new()
Creates an instance of the XbpCrt class.
Configuration

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.

:alwaysOnTop
Determines whether the dialog can be covered by other windows.
:border
Border type for the XbpCrt window.
:clipChildren
Determines whether the Xbase Parts in the child list are clipped during graphic output.
:closeable
Determines whether the "Close" menu item in the system menu is available.
:fontHeight
Sets the height of the font for displaying characters in the text mode.
:fontName
Sets the name of the font for displaying characters in the text mode.
:fontWidth
Sets the width of the font used to display characters in the text mode.
:gridMove
Restricts the movement of the window to increments of :fontWidth when the mouse is used to move the window.
:icon
The resource ID of an icon.
:inputMode
Specifies the input mode.
:minMax
Displays pushbuttons for minimizing and maximizing the window.
:sysMenu
Determines whether to include the system menu in the title bar of the window.
:taskList
Determines whether the XbpCrt window is included as an item in the task list.
:title
Title of the XbpCrt window
:titleBar
Determines whether the title bar of the XbpCrt window is displayed.
:useVisualStyle
Determines whether the XbpCrt object uses a Visual Style for display.
:visible
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.

:asyncFlush
Determines the display behavior of text-mode output.
:autoFocus
Determines whether automatic focus changes are allowed.
:autoMark
Turn the ability to select text on or off.
:dropFont
Allow the user to change the font by dragging & dropping from the font manager.
:dropZone
Determines whether the object is a drop zone.
:hasDisplayFocus
Specifies whether the Crt window is currently the active window.
:helpLink
The XbpHelpLabel object for context sensitive help.
:maxCol
Position of the rightmost viewable text column in an XbpCrt window.
:maxRow
Position of the bottom viewable text row in an XbpCrt window.
:mouseMode
Determines whether mouse coordinates are given as graphics or text coordinates.
:modalResult
Specifies the result of a modal dialog.
:toolTipText
Specifies the tooltip text to be displayed.
:useShortCuts
Enables shortcut keys for the system menu.
:xSize
The width of the display area of an XbpCrt window in pixels.
:ySize
The height of the display area of an XbpCrt window in pixels.
Life cycle
:create()
Requests system resources for the object.
:configure()
Reconfigures the Xbase Part after :create() has been executed.
:destroy()
Releases the system resources of the object.
Methods
:currentPos()
Returns the current position of the window.
:currentSize()
Returns the current size of the XbpCrt window.
:showModal()
Displays the XbpCrt object as a modal dialog.
:getFrameState()
Determines the current display state of the XbpCrt window.
:getModalState()
Returns the modal state of the window.
:hasMenuBar()
Specifies whether the XbpCrt object has a menu bar.
:hide()
Suppresses the display of the XbpCrt window on the screen.
:isVisible()
Returns whether an XbpCrt window is visible.
:mapPoint()
Map a point from one coordinate space to another
:menuBar()
Installs an XbpMenubar object in the XbpCrt window.
:presSpace()
Returns the presentation space linked to the XbpCrt window.
:setFont()
Sets or returns a font object used by the XbpCrt window.
:setFontCompoundName()
Sets or returns the font "compound name".
:setFrameState()
Sets the display state of the XbpCrt window.
:setModalState()
Defines the XbpCrt window as "modal" or "non-modal".
:setPointer()
Defines the shape of the mouse pointer.
:setTrackPointer()
Switches automatic mouse pointer tracking on or off.
:setPos()
Repositions the XbpCrt window.
:setSize()
Changes the size of the XbpCrt window.
:setTitle()
Defines a new title for the XbpCrt window.
:show()
Redisplays the XbpCrt window after it has been hidden.
:toBack()
Shifts the XbpCrt window to the background.
:toFront()
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.
Examples
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 "Appevent.ch" 

PROCEDURE Main 
   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:create() 
   oXbp:setInputFocus  := bSetFocus 
   oXbp:killInputFocus := bKillFocus 

   oXbp := XbpCrt():new( ,, {300, 70}, 15, 35, "Child B" ) 
   oXbp:autoFocus := .F.            // Second child window 
   oXbp:create() 
   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 
         EXIT 
      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 ) 
      ENDIF 
   ENDDO 
RETURN 
Feedback

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.