Classes

Class XbpWindow() Foundation

Class function of the XbpWindow class.

Superclass
Description

The XbpWindow class is an abstract class that provides the mechanisms for displaying graphic dialog elements (Xbase Parts) on the screen. All Xbase Parts displayed on the screen are derived from this class (except the system dialogs that are derived from XbpSysWindow()). This includes dialog elements like pushbuttons and checkboxes, as well as complete dialogs. XbpWindow objects manage a window on the screen. They do not actually provide a "window" (dialog) in the sense of the user interface, but handle the display in a defined rectangular section of the screen. An XbpWindow object provides several general methods and instance variables that are needed to display a window and that are required by all dialog elements.

The XbpWindow class is derived from the XbpPartHandler class and inherits the ability to understand and react to events. Another important characteristic of an XbpWindow object is its capability for interaction. It can react to events that occur within the screen area managed by the object. Within the XbpWindow class, a number of default events are handled and reactions to these events occur when the :handleEvent() method is called. For each default event, a method exists that is executed after the event occurs. As an example, clicking the left mouse button generates the event xbeM_LbClick. When this event occurs, the :LbClick() method is executed. This is done automatically within the method :handleEvent(). The following lines illustrate this:

DO WHILE .T.                                // event loop 
   nEvent := AppEvent( @mp1, @mp2, @oXbp )  // read event 
   oXbp:handleEvent( nEvent, mp1, mp2 )     // react 
ENDDO 

/*      Internal in the method :handleEvent() 
DO CASE 
... 
CASE nEvent == xbeM_LbClick 
   self:LbClick( mp1, mp2 ) 
ENDCASE 
*/ 

The event is retrieved using AppEvent() and passed to the method :handleEvent() where the reaction occurs. After the event is received, the corresponding method is executed. For this reason, these methods are referred to as "callback methods".

Callback methods can be redefined by programmers when they create new classes that inherit from Xbase Parts. Alternatively, the reaction to an event can be defined using a code block stored in specific instance variables of the XbpWindow object. These instance variables are called "callback slots". Callback slots are instance variables that have the same name as the corresponding callback methods. When a code block is assigned to one of these instance variables, the code block is executed after the execution of the callback method.

Since the XbpWindow class is an abstract class, no instances of it can be created. Its purpose is to provide functionality to other classes that are derived from it. The functionality provided by this class includes screen management and reactions to events. The latter can be defined using code blocks that are assigned to callback slots or by overloading the callback methods. For each callback slot, a method with the same name exists and can be overloaded (redefined) in subclasses. When a callback method is defined in a subclass, it is executed when the corresponding event occurs.

When new user defined dialog elements are derived to use the functionality of the XbpWindow class, an existing XBP class that clearly defines the type of dialog element must be used as the superclass. For example, the XbpDialog class or the XbpPushbutton class can be used as the superclass. A class declaration inheriting directly from the XbpWindow class (such as CLASS xyz FROM XbpWindow) is not allowed.

Configuration

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

:animate
Indicates whether animation is activated when the window is opened.
:clipChildren
Determines whether Xbase Parts in the child list are clipped during graphic output.
:clipParent
Determines whether the parent is clipped during graphic output.
:clipSiblings
Determines whether siblings are clipped during graphic output.
:group
Groups Xbase Parts for navigation using the Tab key.
:layoutAlign
Contains alignment and layout information.
:layoutManager
Specifies an object which controls child arrangement.
:sizeRedraw
Controls how the object is redrawn during resize operations.
:styleClass
Specifies the visual style class that defines object appearance.
:stylePart
Specifies the id of the part within the visual style class assigned.
:tabStop
Allows the Xbase Part to be accessed during navigation with the Tab key.
:useVisualStyle
Determines whether the object uses a Visual Style for display.
:visible
Determines whether the dialog element is visible after :create() is executed.
:visualStyle
Specifies the visual style to use for displaying the object.
Runtime data
:controlState
Determines the current state of the object.
:dropZone
Determines whether the object is a drop zone.
:helpLink
The XbpHelpLabel object for context sensitive help.
:inputMode
Specifies the input mode.
:tooltipText
Specifies the tooltip text to be displayed.
Life cycle
:init()
Initializes instance variables.
: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.
Manipulation
:captureMouse()
Sends all mouse messages to the Xbase Part.
:disable()
Disables the Xbase Part.
:enable()
Enables the Xbase Part.
:getInvalidRect()
Get current invalid rectangle of the Xbase Part.
:hide()
Suppresses the display of the Xbase Part on the screen.
:invalidateRect()
Mark a window area as invalid (for redraw).
:lockPS()
Requests a presentation space and locks it.
:lockUpdate()
Suppresses automatic screen updates.
:mapPoint()
Map a point from one coordinate space to another
:setModalState()
Defines the 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 Xbase Part.
:setPosAndSize()
Changes position and size of the Xbase Part.
:setSize()
Changes the size of the Xbase Part.
:show()
Redisplays a hidden Xbase Part.
:toBack()
Shifts the Xbase Part to the background.
:toFront()
Brings the Xbase Part to the foreground.
:unlockPS()
Unlocks a presentation space that was locked using :lockPS().
:winDevice()
Determines the device context for the window.
Settings
:setColorBG()
Sets or returns the background color
:setColorFG()
Sets or returns the foreground color.
:setFont()
Sets or returns a font object used by Xbase Parts displaying characters.
:setFontCompoundName()
Sets or returns the font "compound name".
:setPresParam()
Sets or returns the presentation parameter array.
Status
:currentPos()
Returns the current position of the window.
:currentSize()
Returns the current size of the window.
:getHWND()
Retrieves the handle of a window
:getModalState()
Returns the modal state of the window.
:hasInputFocus()
Returns whether the Xbase Part has input focus.
:isEnabled()
Returns whether an Xbase Part is enabled.
:isVisible()
Returns whether the Xbase Part is visible.
:isUICueActive()
Tests whether certain visual cues are active.
Mouse messages

If the :wheel() method is overloaded, the number of rows to scroll can be calculated from the number of rows displayed by the Xbase Part and the second element of <aWheel>:

nResolution   := 360  // 240, 480 changes scrolling speed 
nRowsToScroll := Int( nRowCount * aWheel[2] / nResolution ) 

When the first element of <aWheel> is not equal to zero, the $ operator can be used to check which additional keys are pressed while the mouse wheel is rotated. For example:

nEvent := AppEvent( @mp1, @mp2, @oXbp ) 

IF nEvent == xbeM_Wheel 
   IF XBP_MK_SHIFT $ mp2[1] 
      // code for Shift key processing 
   ENDIF 
ENDIF 

The event xbeM_Wheel is not supported for ActiveX controls. If an ActiveX control supports similar functionality, the corresponding COM/ActiveX methods or interfaces must be used instead.

Windows 95 does not support the mouse wheel.

xbeM_Enter
Mouse moved into display rectangle.
xbeM_Leave
Mouse moved out of the display rectangle.
xbeM_LbClick
Left mouse button clicked.
xbeM_LbDblClick
Left mouse button double clicked.
xbeM_LbDown
Left mouse button pressed.
xbeM_LbUp
Left mouse button released.
xbeM_MbClick
Middle mouse button click.
xbeM_MbDblClick
Middle mouse button double clicked.
xbeM_MbDown
Middle mouse button pressed.
xbeM_MbUp
Middle mouse button released.
xbeM_Motion
Mouse has been moved.
xbeM_RbClick
Right mouse button clicked.
xbeM_RbDblClick
Right mouse button double clicked.
xbeM_RbDown
Right mouse button was pressed.
xbeM_RbUp
Right mouse button released.
xbeM_Wheel
Mouse wheel is activated.
Other messages
xbeP_Gesture
A touch gesture was performed.
xbeP_HelpRequest
Help has been requested.
xbeP_Keyboard
Keyboard input received.
xbeP_KillInputFocus
Xbase Part is losing input focus.
xbeP_Move
Xbase Part has been moved.
xbeP_Paint
Xbase Part has been redrawn.
xbeP_Quit
Application will be terminated.
xbeP_Resize
Size of the Xbase Part has changed.
xbeP_SetInputFocus
Input focus set.
xbeP_DragEnter
Item has been dragged over a drop zone.
xbeP_DragMotion
Item is being dragged inside a drop zone.
xbeP_DragLeave
Item has been moved outside a drop zone.
xbeP_DragDrop
Item has been dropped over a drop zone.
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.