_SPELLCHK

Form, Formset

Forms and formsets are container classes that, from one point of view, put the "visual" in Visual FoxPro. Formsets contain forms and toolbars. Forms contain controls.

Form

Property

Value

Meaning

ActiveControl

Object

A reference to the control on the form that currently has focus.

AlwaysOnBottom

Logical

Determines whether this form always stays underneath other windows, like a kind of wallpaper.

AlwaysOnTop

Logical

Determines whether this form stays on top of other windows, even when it doesn't have focus.

AutoCenter

Logical

Determines whether the form automatically centers itself when it first appears. Also allows you to center a form at any time.

BorderStyle

Numeric

Determines the type of border of the form. Also determines whether the form can be resized.

BufferMode

Numeric

Determines the type of buffering used for cursors in the form's data environment, unless the cursors override this setting individually.

Caption

Character

The title that appears in the form's border.

ClipControls

Logical

Determines what gets redrawn when the form is resized or controls are moved about.

Closable

Logical

Determines whether the form can be closed by the operator with the mouse and Ctrl+F4.

ContinuousScroll

Logical

Determines how the form behaves when you use the scrollbars.

ControlBox

Logical

Determines whether the form has a Windows standard control menu.

ControlCount

Numeric

The number of controls currently on the form.

Controls

Collection

References to the controls currently on the form.

CurrentX, CurrentY

Numeric

The position of the drawing cursor on the form.

DataSession

Numeric

Determines whether the form has its own private data session.

DataSessionId

Numeric

The data session being used by the form.

DefOLELCId

Numeric

Indicates the default locale ID (language) for OLE objects used in the form.

Desktop

Logical

Determines whether the form is contained in the main Visual FoxPro window.

DrawMode

Numeric

Determines the way colors work in drawing methods.

DrawStyle

Numeric

The type of lines drawn by drawing methods.

DrawWidth

Numeric

The width of lines drawn by drawing methods.

FillColor

Numeric

The color used to fill figures drawn with drawing methods.

FillStyle

Numeric

The pattern used to fill figures drawn with drawing methods.

HalfHeightCaption

Logical

Determines whether the title bar uses a FoxPro/DOS compatibility style or the standard Windows style. Although the two choices are nearly indistinguishable visually, there are functional differences. Keep this property set to .F.

HScrollSmallChange

Numeric

Determines how far the form scrolls on a single click on a horizontal scroll arrow.

hWnd

Numeric

The Windows window handle of the form.

Icon

Character

The icon file used in the form's title bar.

KeyPreview

Logical

Determines whose KeyPress event fires when the user presses a key—the form's or the control's.

LockScreen

Logical

Determines whether the form is visually updated immediately when some kinds of changes are made to the form or its controls.

MaxButton, MinButton

Logical

Determines whether the form has maximize and minimize buttons.

MaxHeight, MaxWidth

Numeric

The largest size to which the user can resize the form.

MaxLeft, MaxTop

Numeric

The position at which the form appears when maximized.

MDIForm

Logical

Determines whether the form behaves like an MDI (multiple document interface) form.

MinHeight, MinWidth

Numeric

The smallest size to which the user can resize the form.

Movable

Logical

Determines whether the user can move the form.

Objects

Collection

Contains a reference to every object contained within the form.

Picture

Character

File name of a picture to be tiled as wallpaper on the form.

ReleaseType

Numeric

Indicates how the form was released.

ScaleMode

Numeric

The measurement system used for the form.

ScrollBars

Numeric

Determines what kind of scrollbars, if any, the form has.

ShowInTaskBar

Logical

Determines whether the top-level form appears in the task bar at runtime. Ignored if the ShowWindow property is anything other than 2 (top-level form).

ShowTips

Logical

Determines whether tooltips are displayed.

ShowWindow

Numeric

Determines whether the form is a child of the VFP window, a top-level form itself, or a child of a top-level form.

TitleBar

Numeric

Determines whether the form has a title bar.

ViewPortHeight, ViewPortWidth

Numeric

Indicate the size of the viewport into the form, that is, the size of the visible area.

ViewPortLeft, ViewPortTop

Numeric

Indicate the top left corner of the portion of the form currently visible.

VScrollSmallChange

Numeric

Determines how far the form scrolls on a single click on a vertical scroll arrow.

WindowState

Numeric

Is the form normal size, maximized or minimized?

WindowType

Numeric

Indicates whether the form is modal or modeless. Also used to indicate READ compatibility.


Event

Purpose

Activate, Deactivate

Fire when the form gains or loses focus.

Load, Unload

First and last events to fire.

Moved

Fires when the form is moved.

Paint

Fires when part of the form is exposed and has to be redrawn.

QueryUnload

Fires when the form is released. Issue NODEFAULT in this method to prevent the form from being destroyed.

Resize

Fires when the form is resized.

Scrolled

Fires when the form's scrollbars are used.


Method

Purpose

Box, Circle, Line

Drawing methods that put figures on the form.

Cls

Drawing method that clears figures and text from the form.

Draw

Repaints the form.

Point

Returns the color of a particular point.

Print

Drawing method that puts text on the form.

PSet

Sets the color of a particular point.

Release

Destroys the form.

SaveAs

Creates a new SCX based on the currently displayed form.

SaveAsClass

Creates a new class in a VCX based on the currently displayed form.

SetViewPort

Sets the ViewPortLeft and ViewPortTop properties to determine which portion of the form is visible.

Show, Hide

Make the form visible and invisible. Show also activates the form initially.

TextHeight, TextWidth

Return the height and width of a specified string in the current form's font.


FormSet

Property

Value

Meaning

ActiveForm

Object

Reference to the form in the set that has focus.

AutoRelease

Logical

Indicates whether the formset object should be released when all the forms in the set have been released.

BufferMode

Numeric

Determines the type of buffering used by default for cursors in the formset.

DataSession

Numeric

Determines whether the formset has its own private data session.

DataSessionId

Numeric

The data session being used by the formset.

FormCount

Numeric

The number of forms in the set.

Forms

Collection

References to the forms in the set.

Objects

Collection

Contains a reference to every object contained within the formset.

ReadCycle, ReadLock, ReadMouse, ReadObject, ReadSave, ReadTimeOut, WindowList

Various

Special properties used only in forms converted from FoxPro 2.x screens. They correspond to various READ clauses.

WindowType

Numeric

Indicates whether the formset is modal or modeless. Also used to indicate READ compatibility.


Event

Purpose

Activate, Deactivate

Fire when the formset gains or loses focus.

Load, Unload

First and last events to fire in the formset.

ReadActivate, ReadDeactivate, ReadShow, ReadValid, ReadWhen

Events to model FoxPro 2.x READ clauses. Used only for forms converted from FoxPro 2.x screens.


Method

Purpose

Release

Destroys the formset.

Show, Hide

Makes the formset visible and invisible. Show also activates the formset initially.


Forms and formsets are different from other objects in Visual FoxPro for several reasons. First, there are two different ways to create and activate them. Like other objects, they can be stored as classes, then instantiated with CREATEOBJECT() or NEWOBJECT(). However, individual form and formset instances can also be stored in SCX files and executed with DO FORM. (Note that form and formset classes stored in VCX libraries do not include a data environment, while forms stored in SCXs do.)

The second difference is that forms and formsets have Load and Unload methods that fire before Init and after Destroy, respectively. Load lets you open databases and tables before the controls in a form are instantiated and initialized, so you can bind controls to fields. Similarly, the controls need to be destroyed before you can close the tables—Unload (which follows the Destroys for the controls) gives you that opportunity. (You use Load and Unload for table handling only if you're not letting the data environment automatically open and close tables. Since you can't save a data environment with a form or formset class, there are some good reasons to use Load and Unload this way.)

The firing sequence is confusing, though, because parameters to a form or formset are normally passed to the Init method, just like other controls, even though other events fire first. (For forms converted from 2.x, parameters go to the Load method.)

It took us awhile to catch on that windows you create with DEFINE WINDOW are really forms, too. In fact, there's no reason ever to define a window again. Just instantiate a form and you can put whatever you want in it. There's nothing to keep you from putting a Browse in an instantiated form, for example (not that we use Browse anything but interactively in Visual FoxPro).

Example

DEFINE CLASS HackForm AS Form    Caption = "Hacker's Example Form"    BackColor = RGB(0,0,255)    ForeColor = RGB(255,255,255)      PROCEDURE Resize       LOCAL cMessage       cMessage = "Hey, watch it, buster!"       This.Cls       This.CurrentX = (This.Width-This.TextWidth(cMessage))/2       This.CurrentY = This.Height/2       This.Print(cMessage)    ENDPROC      PROCEDURE Moved       LOCAL cMessage       cMessage = "Who do you think you're moving?"       This.Cls       This.FillColor = RGB(255,0,0)       This.FillStyle = 0       This.Box(This.Width/4, This.Height/4,;                3*This.Width/4,3*This.Height/4 )       This.CurrentY = This.Height/2       This.CurrentX = This.Width/4 + 2       This.Print(cMessage)    ENDPROC ENDDEFINE

See Also

Activate, ActiveControl, ActiveForm, AlwaysOnBottom, AlwaysOnTop, AutoCenter, AutoRelease, BorderStyle, Box, BufferMode, Caption, Circle, ClipControls, Closable, Cls, ContinuousScroll, ControlBox, ControlCount, Controls, Create Form, CreateObject(), CurrentX, CurrentY, DataEnvironment, DataSession, DataSessionId, Deactivate, Define Window, DefOLELCId, Desktop, Do Form, Draw, DrawMode, DrawStyle, FillColor, FillStyle, FormCount, Forms, HalfHeightCaption, Hide, HScrollSmallChange, HWnd, Icon, KeyPreview, Line Method, Load Event, LockScreen, MaxButton, MaxHeight, MaxLeft, MaxTop, MaxWidth, MDIForm, MinButton, MinHeight, MinWidth, Movable, Moved, NewObject(), Objects, Paint, Picture, Point, Print, PSet, QueryUnload, ReadActivate, ReadCycle, ReadDeactivate, ReadLock, ReadMouse, ReadObject, ReadSave, ReadShow, ReadTimeOut, ReadValid, ReadWhen, Release Method, ReleaseType, Resize, SaveAs, SaveAsClass, ScaleMode, ScrollBars, Scrolled, SetViewPort, Show, ShowInTaskbar, ShowTips, ShowWindow, TextWidth, TextHeight, TitleBar, Unload, ViewPortHeight, ViewPortLeft, ViewPortTop, ViewPortWidth, VScrollSmallChange, WindowList, WindowState, WindowType


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net