Click or drag to resize

DataWindow Class

X#
Create a data window which is capable of interacting intelligently with a data server.
Inheritance Hierarchy
Object
  VObject
    EventContext
      Window
        AppWindow
          ChildAppWindow
            DataWindow
              DataDialog
              OLEDataWindow

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.24 GA
Syntax
 CLASS DataWindow INHERIT ChildAppWindow
Request Example View Source

The DataWindow type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleDataWindow
Construct a data window.
Top
Properties
  NameDescription
Public propertyAllowServerClose
A logical value specifying whether the server is automatically closed with the data window. By default, this is set to TRUE in the DataWindow:Init() method.
Public propertyAutoScroll
A data window scrolls automatically to any control which gains focus while tabbing, even if the control is not visible (for example, when the window is resized). By setting AutoScroll to FALSE, this automatic scrolling behavior is blocked.
Public propertyBackground
The background brush currently in use by this data window.
(Overrides Background.)
Public propertyBrowser
The DataBrowser object to use when this data window is displayed in browse view.
Public propertyBrowserClass
A symbol specifying the class used for the data window's browse mode. Valid values are: #DATABROWSER, #DATALISTVIEW, or any user-defined class. The default is #DATABROWSER.
Public propertyCaption (Overrides Caption.)
Public propertyClipperKeys
A logical value indicating that the Clipper navigation keys (i.e., the Direction and Return keys) are to be used for this data window (TRUE if yes, FALSE if no).
Public propertyConcurrencyControl
A constant, identifying the mode of automatic concurrency control for this data window, determining when and how records are locked and released:
Public propertyContextMenu
The context menu attached to the window
(Overrides ContextMenu.)
Public propertyCurrentView
A symbol representing the view mode of the data window, as #BrowseView or #FormView.
Public propertyDeferUse
A logical value specifying whether the Use() operation for connecting the data window to the associated server should be deferred until the data window is first displayed.
Public propertyForeground
The foreground brush currently in use by this data window.
(Overrides Foreground.)
Public propertyMenu (Overrides Menu.)
Public propertyCode exampleOrigin
The point representing the new location of this data window, in the canvas coordinates of its owner.
(Overrides Origin.)
Public propertyOwnerAlignment
The Owner Alignment value for the window, which is used when the window is a subwindow on another window.
(Overrides OwnerAlignment.)
Public propertyPen (Overrides Pen.)
Public propertyPointer
The pointer used by the data window to represent the mouse when it enters the window.
(Overrides Pointer.)
Public propertyPreventAutoLayout
A logical value indicating that the AutoLayout behavior of the data window is blocked (TRUE if yes, FALSE if no). An empty data window does not create controls automatically when it first uses a new data server.
Public propertyServer
The DataServer object currently connected to this data window. If no server is connected, this value is NIL.
Public propertyCode exampleSize
The dimension representing the size of this data window in canvas coordinates.
(Overrides Size.)
Public propertyCode exampleStatus
A hyperlabel identifying the status of this data window after the last operation.
Public propertyToolBar (Overrides ToolBar.)
Top
Methods
  NameDescription
Public methodActivate
Provide a method that is invoked when this window is activated.
(Overrides Activate(Usual).)
Public methodAppend
Append a blank record to the data server connected to this data window and position the window on this new record.
Public methodButtonClick
Provide a method that is invoked when a check box, push button, or radio button is clicked with the mouse.
(Overrides ButtonClick(Usual).)
Public methodCancel
Discard all information entered in this data window and close the window.
Public methodCanvasErase
Erase the current canvas area of this data window and repaint it using either the background brush or the system's default background color.
(Overrides CanvasErase.)
Public methodChangeFont
Change the font used by this datawindow.
Public methodCheckStatus
Test the information currently displayed in the controls in this data window to see if it passes all validation rules defined to the connected server.
Public methodClear
Clear the current selection in this data window.
Public methodClearRelations
Clear all relations defined to this data window's server.
Public methodClose
Invoked just as the data window is about to close.
(Overrides Close(Usual).)
Public methodCommit
Force all pending updates to this data window's server to be permanently written to disk.
Public methodControlFocusChange
Provide a method that is invoked when the input focus changes to or from a control.
Public methodCopy
Copy the current selection in this data window to the clipboard.
Public methodCut
Delete the current selection in this data window and copy it to the clipboard.
Public methodDeActivate
Provide a method that is invoked when this window is deactivated.
(Overrides DeActivate(Usual).)
Public methodDeactivateAllOLEObjects (Overrides DeactivateAllOLEObjects(Usual).)
Public methodDelete
Delete the current record in the attached server and update the window based on the change.
Public methodDeleteValidated
Delete the current record in the attached server only if it passes its validation rules and update the window based on the change.
Public methodDestroy
Free memory resources allocated for a window and its derived objects.
(Overrides Destroy.)
Public methodDisableConditionalControls
Disable those controls in this data window that have been registered with RegisterConditionalControls().
Public methodDispatch
Provide the dispatcher for events within the system when the window has focus; routing various events to their appropriate event handlers.
(Overrides Dispatch(Usual).)
Public methodDraw
Display a Draw object on this data window.
(Overrides Draw(Usual).)
Public methodEditChange
Provide a method that is invoked when the text in an edit control is changed.
(Overrides EditChange(Usual).)
Public methodEnableConditionalControls
Enable those controls that have been registered with RegisterConditionalControls().
Public methodEnableDragDropClient
Public methodEnableStatusBar
Enable/disable a status bar in an application window.
(Overrides EnableStatusBar(Usual).)
Public methodEnableToolTips
Enable or disable the tooltips for a window. Note that assigning a value to Control:ToolTipText automatically enables the tooltip's display on the parent window.
(Overrides EnableToolTips(Usual).)
Public methodError
Provide a method for handling error conditions raised during data window processing.
Public methodExpose
Provide a method that is invoked whenever part of the data window needs repainting.
(Overrides Expose(Usual).)
Public methodFIELDGET
Retrieve the current value of the indicated control in this data window (and the data server field associated with this control, if any).
Public methodFIELDPUT
Set the value of the control in this data window (and the data server field associated with this control, if any).
Public methodCode exampleFocusChange
Provide a method that is invoked when the input focus changes from the current data window to another window (or vice versa).
(Overrides FocusChange(Usual).)
Public methodGetAllChildren
Obtain an array of all X# children objects of the window.
(Overrides GetAllChildren.)
Public methodGoBottom
Position the data server connected to this data window on the last logical record and update the window based on the change.
Public methodGoTo
Position the data server connected to this data window on a specified record number and update the window based on the change.
Public methodGoTop
Position the data server connected to this data window on the first logical record and update the window based on the change.
Public methodHelpRequest
Provide a method that is invoked when the user requests help from the application using one of the available context-sensitive help mechanisms.
(Overrides HelpRequest(Usual).)
Public methodHide
Hide this data window so it is not visible.
(Overrides Hide.)
Public methodHorizontalScroll
Provide a method that is invoked when a horizontal scroll bar is scrolled.
(Overrides HorizontalScroll(Usual).)
Public methodHorizontalSlide
Provide a method that is invoked when a horizontal slider's thumb is dragged either by the mouse or the keyboard.
(Overrides HorizontalSlide(Usual).)
Public methodHorizontalSpin
Provide a method that is invoked when a horizontal spinner is spun.
(Overrides HorizontalSpin(Usual).)
Public methodInsertObject
Use the standard Insert Object dialog to insert an OLE object into the focused OLEObject of the data window.
Public methodLineTo
Draw a line on this data window (using the current pen) from the current pen position to a specified point.
(Overrides LineTo(Usual).)
Public methodListBoxClick
Provide a method that is invoked when an item in a list box owned by this data window is double-clicked.
(Overrides ListBoxClick(Usual).)
Public methodListBoxSelect
Provide a method that is invoked when an item in a list box owned by this data window is clicked.
(Overrides ListBoxSelect(Usual).)
Public methodMouseButtonDown
Provide a method that is invoked when the mouse pointer is positioned over the window and a mouse button is clicked.
(Overrides MouseButtonDown(Usual).)
Public methodMoveTo
Move the current pen to a point on the data window's canvas area.
(Overrides MoveTo(Usual).)
Public methodNotify
An event handler that reflects events that have occurred in the server connected to this data window.
Important! Notify() is automatically called by the server, and should normally not be called by application code.
Public methodOK
Accept all information entered in this data window and close the window.
Public methodCode exampleOLEInPlaceActivate
Called whenever a child OLE object is about to be "inplace" activated.
(Overrides OLEInPlaceActivate.)
Public methodCode exampleOLEInPlaceDeactivate
Called whenever a child OLE object is about to be "inplace" deactivated.
(Overrides OLEInPlaceDeactivate.)
Public methodPaintBoundingBox
Paint a rectangular area in the data window using a specified painting method.
(Overrides PaintBoundingBox(Usual, Usual).)
Public methodPaste
Replace the current selection in this data window with the contents of the clipboard.
Public methodPasteSpecial
Use the standard Paste Special dialog to insert an OLE object into the focused OLEObject of the data window.
Public methodPreValidate
Called after any status change in this data window to allow controls and menu commands to be enabled/disabled based on the current validation status.
Public methodQueryClose
Provide a method that is invoked just before the data window closes to confirm if the application really wants to close the window.
(Overrides QueryClose(Usual).)
Public methodRegisterConditionalControls
Register a control in this data window as being subject to validation status and hence automatically dimmed whenever the window is in an invalid state.
Public methodRePaint
Send an ExposeEvent to repaint the data window's canvas area.
(Overrides RePaint.)
Public methodRepaintBoundingBox
Repaint a rectangular area in the data window.
(Overrides RepaintBoundingBox(Usual).)
Public methodResize
Provide a method that is invoked when the data window changes size.
(Overrides Resize(Usual).)
Public methodSeek
Search for a value in the data server connected to this data window based on a controlling search order and update the window based on the change.
Public methodSetAlignStartSize
Sets the start size of the form window. In general, this size is set with the first assign to OwnerAlignment but it can be useful when trying to control the sizes for yourself.
(Overrides SetAlignStartSize(Usual).)
Public methodCode exampleSetRelation
Set a relation from the data server connected to this data window to the data server of another, creating an owner-child relationship between the two servers and the two windows.
Public methodCode exampleSetSelectiveRelation
Set a selective relation from this window to the child window, or actually from the server of this window to the server of the other window. A selective relation is one that limits operations on the child server to those records that match the relation condition.
Public methodShow
Display a window.
(Overrides Show(Usual).)
Public methodSkip
Move forward or backward in the server by a specified number of records.
Public methodSkipNext
Move to the next record (identical to Skip(1)).
Public methodSkipPrevious
Move to the previous record (identical to Skip(-1)).
Public methodStatusOK
Indicate the current validation status of the window through a return code and by setting the DataWindow:Status property.
Public methodTextPrint
Display a given string on the data window at a specified location using the current font and the current pen color.
(Overrides TextPrint(Usual, Usual).)
Public methodToolBarHeightChanged
Provide a method that is invoked when the height of the window's toolbar is changed.
(Overrides ToolBarHeightChanged(Usual).)
Public methodUndo
Undo recent changes made in this data window.
Public methodUndoAll
Undo all changes made in this data window since the last record movement or Commit() operation.
Public methodUpdateActiveObject
Update the toolbars of any in-place active OLE objects.
Public methodUse
Connect the data window to a data server in a client-server relationship.
Public methodVerticalScroll
Provide a method that is invoked when a vertical scroll bar is scrolled.
(Overrides VerticalScroll(Usual).)
Public methodVerticalSlide
Provide a method that is invoked when a vertical slider's thumb is dragged either by the mouse or the keyboard.
(Overrides VerticalSlide(Usual).)
Public methodVerticalSpin
Provide a method that is invoked when a vertical spinner is spun.
(Overrides VerticalSpin(Usual).)
Public methodViewAs
Specify the view mode of the data window, as browse view or form view.
Public methodViewForm
Select form view for the data window.
Public methodViewTable
Select browse view for the data window.
Top
Fields
  NameDescription
Public fieldsymFormDialog
Top
Remarks
Data windows combine the properties and behavior of both child windows and dialog windows, and add data-aware behavior that enables them to interact intelligently with data servers. When connected to a data server, a data window forms a view of the server that allows for direct access and manipulation of the server's data. Unlike the other types of windows, a data window takes on different behavior depending on how it is used. It adapts itself to the demands placed on it by its owner, behaving differently depending on the circumstances: If Owner Is Data Window Acts Like ChildAppWindow Modal DialogWindow DataWindow Modal DialogWindow (if no placement is specified) or nested sub-data window (if placement is specified) DialogWindow Modal DialogWindow ShellWindow ChildAppWindow TopAppWindow Modal DialogWindow A data window can be placed on a data window in an owner-child relationship (similar to other controls like check boxes and radio buttons). When a data window is placed on another data window in this way, it is referred to as a sub-data window. Note that only a data window can own a sub-data window because it is the only window type of window that can deal with data-related events. You can create a data window as a sub-data window when the data window is created. You can optionally specify a third parameter (nResourceID), indicating that the new data window should be created as a control on a window by giving its location and size. When placed like a control, the data window hides its border decoration and behaves like a sub-data window. (If this parameter is omitted, the data window is created as a modal DialogWindow, not a sub-data window.) See DataWindow:Init() for details. Tip: Instead of newly creating a data window, you may prefer to use the Window Editor's Auto Layout feature which—at the touch of a button—automatically creates controls for every available field in a data window's associated data server(s). See "Using the Window Editor" in the IDE User Guide. A data window is connected to a server with the Use() method. When this connection is established, each control on the window is connected to a field in the data server based on matching names: a field named CustName is connected to the control named CustName. The control always reflects the current value of the data in the data server, and assigning a value to a control automatically propagates it to the server. Data windows can be associated with data servers in two ways: in a single server or dual server (master detail) relationship. The Master-Detail option allows you to link a window to two data servers in a master-detail relationship. In this case, a data window is created for the master server with a nested sub-data window for the detail server. The field list presented is taken from the Master data server. The field that you choose is used to perform a SetSelectiveRelation() to the detail server based on its controlling order. If you do not choose a field, the detail window is updated relative to the current record position in the master window. A data window can take on two different view modes: form view, which contains individual controls for the data fields and browse view, which contains a spreadsheet-like data browser. The data window can be initially displayed in either mode, and can be switched to the other mode at any time (using the DataWindow:ViewAs() method). Any data window supports both appearances, although the developer can, of course, choose not to provide a way to select one mode or the other. The two view modes provide the same set of facilities: the same data linkage facilities, the same display options, the same data manipulation methods. From the perspective of the application, a data window has the same behavior and the same data properties regardless of view mode. The standard way of using a data window is to paint its layout in the Window Editor. This produces a resource entity that specifies what controls the window has, and their locations, sizes, captions, and accelerators. It also generates a data window subclass and an Init() method that associates names and further annotation with each control. With such a predefined layout, the window is displayed very quickly and the methods of the window have enough information to act intelligently. A data window can also be created without a resource entity. In this case, the layout of controls on the window is automatically generated when the window is connected to a data server. After a layout is automatically generated, the window has exactly the same behavior that it has with a resource-based instantiation. If a data window is switched over to a new view mode, and the new mode has not been defined through a resource entity or programmatically, the data window automatically creates a layout based on the characteristics of the connected data server. The new layout picks up all information about fields and controls that is known to the other view; thus, if complex validation rules, prompts, and help have been specified for the individual controls in form view, the columns of the browse view inherit the same properties. When a control is connected to a field in a data server, a value entered into the control or assigned to the appropriate name from the program is automatically propagated to the server. Thus, after executing this statement:
X#
1oCustomerWindow:CustName := x
the CustName field in the server has the correct value. Values are propagated up from the data server to the data window when the server repositions itself, or when another window makes a change. This requires no special action: after executing a Skip() method or assigning a value to a field, every window connected to the server is automatically updated to reflect the change. Data entered by the user is automatically validated using the rules of the field specification attached to a control or column. (For more detail on the validation rules provided, see the FieldSpec class.) If data fails the validation test, the data window will not propagate invalid information down to the server or to other windows, nor will it take any action that requires writing the invalid value to the server. In addition to the field-specific validations, the system allows the specification of a ValidateRecord() method for the window as a whole, for the purpose of cross-field validation. This method, if provided, is called after all the fields have passed their individual validations. The data window also provides for registering controls that are subject to the validation status. Such registered controls are disabled whenever the window's validation status is bad. The data window class also provides action methods that correspond to the general capabilities of all data servers: GoTop(), GoTo(), GoBottom(), SkipNext(), SkipPrevious(), Append(), Delete(), and so on. The data window versions of these methods verify the validation status of the controls on the window. If everything is valid, the window invokes the corresponding method of the data server. The data window provides built-in facilities for concurrency control, automatically taking and releasing record locks as appropriate. Once the appropriate mode has been selected by assigning one of the available modes to DataWindow:ConcurrencyControl, record movements and changes use the concurrency control facilities of the data server to take and release locks. If taking a lock fails because another user controls the record, the data window action fails.
See Also

Reference