Description


Form represents a standard application window (form).



Class: TAForm


Properties

 Property

 Type

 Description

 dbAction

 String

 Contains the name of the action of the button with which the form was called. Possible values: NewRecord, ShowRecord, ShowForm. An empty value indicates that the form was opened with a script. Read-only property.

 AlphaBlend

 Boolean

 Specifies whether the form is translucent. Works since Windows 2000

 AlphaBlendValue

 Integer

 Specifies the degree of translucency on a translucent form. The value is from 0 to 255.

 AutoScroll

 Boolean

 Indicates whether scroll bars appear automatically on the scrolling windowed control if it is not large enough to display all of its controls.

 AutoSize

 Boolean

 Specifies whether the control sizes itself automatically to accommodate its contents.

 BorderIcons

 TBorderIcons

 Specifies which icons appear on the title bar of the form. More info.

 BorderStyle

 TBorderStyle

 Specifies the appearance and behavior of the form border. More info.

 Canvas

 TCanvas

 Provides access to the drawing area of the form. More info.

 Caption

 String

 Window caption.

 CalledForm

 TAForm

 Reference to the form from which the current form was called. Contains an empty value if the form was called with a script.

 ClientWidth

 Integer

 Specifies the horizontal size of the form's client area in pixels (without borders and form header).

 ClientHeight

 Integer

 Specifies the height of the form's client area in pixels (without borders and form header).

 Color

 TColor

 Specifies the background color of the control. More info.

 ComponentCount

 Integer

 Indicates the number of components owned by the component.

 Components[i]

 TComponent

 Allows you to refer to a component on a form by its index.

 ControlCount

 Integer

 Returns the number of child controls.

 Controls[i]

 TControl

 Allows you to refer to a child component on a form by its index.

 Constraints

 TSizeConstraints

 Specifies the size constraints for the control. More info.

 Cursor

 TCursor

 Specifies the image used to represent the mouse pointer when it passes into the region covered by the control. More info.

 Enabled

 Boolean

 Controls whether the control responds to mouse, keyboard, and timer events.

 Font

 TFont

 Allows you to set font name, size, color and style. More info.

 FormStyle

 TFormStyle

 Determines the form's style. Values: fsNormal, fsMDIChild, fsMDIForm, fsStayOnTop

 HorzScrollBar

 TControlScrollBar

 Configuring the appearance and behavior of horizontal scrolling, see also property AutoScroll. More info.

 KeyPreview

 Boolean

 Specifies whether the form should receive keyboard events before the active control.

 Name

 String

 The name of the form.

 Tag

 Integer

 Allows you to assign a number to a component for your own needs.

 TagString

 String

 Allows you to assign a string to a component for your own needs.

 TransparentColor

 Boolean

 Specifies whether a color on the form appears transparent.

 TransparentColorValue

 TColor

 Indicates the color on the form that appears transparent when TransparentColor is true.

 VertScrollBar

 TControlScrollBar

 Configuring the appearance and behavior of the vertical scrolling, see also property AutoScroll. Подробней.

 Visible

 Boolean

 Specifies whether the form appears onscreen.

 WindowState

 TWindowState

 Represents how the form appears on the screen. Values: wsNormal, wsMinimized, wsMaximized

 Left

 Integer

 Specifies the horizontal coordinate of the left edge of a form relative to the screen.

 Top

 Integer

 Specifies the Y coordinate of the upper-left corner of a form, relative to the screen.

 Width

 Integer

 Specifies the horizontal size of the form in pixels.

 Height

 Integer

 Specifies the vertical size of the form in pixels.




Methods

 Method

 Description

 function CanFocus: Boolean

 Indicates whether a control can receive focus. Usually the property is used together with the SetFocus method. Example: if Form1.CanFocus then Form1.SetFocus;

 procedure Close

 Closes the form.

 function FindComponent (const AName: string): TComponent

 Indicates whether a given component is owned by the component. Component name matches are not case sensitive. If no component is found, it returns nil.

 procedure Hide

 Hides the form.

 procedure NewRecord (ParentTable: string = ''; ParentTableID: integer = -1)

 Prepares and shows the form on the screen for creating a new record. Similarly, if the forms were called by the button with the "New Record" action.

 procedure ScaleBy (M, D: Integer)

 Rescale control and its children.

 procedure SetFocus

 Sets focus to the form.

 procedure SetFocusNextControl

 Passes the input focus to the next component on the form.

 procedure Show

 Shows the form.

 procedure ShowModal

 Use ShowModal to show a form as a modal form. A modal form is one where the application can't continue to run until the form is closed. Thus, ShowModal does not return until the form closes.

 procedure ShowRecord (TableName: string; id: integer)

 Displays a form with data from the database for the specified record.




Events

 Event

 Description

 OnClick

 Occurs when the user clicks the control.

 OnClose

 Occurs when the form closes.

 OnDoubleClick

 Occurs when the user double-clicks the left mouse button when the mouse pointer is over the form.

 OnKeyDown

 Occurs when a user presses any key while the form has focus.

 OnKeyPress

 Occurs when a key is pressed. Note that this procedure handles printable characters only.

 OnKeyUp

 Occurs when the user releases a key that was pressed.

 OnMouseDown

 Occurs when the user presses a mouse button with the mouse pointer over a form.

 OnMouseEnter

 Occurs when the user moves the mouse into a form.

 OnMouseLeave

 Occurs when the user moves the mouse outside of a form.

 OnMouseMove

 Occurs when the user moves the mouse pointer while the mouse pointer is over a form.

 OnMouseUp

 Occurs when the user releases a mouse button that was pressed with the mouse pointer over a form.

 OnResize

 Occurs immediately after the form is resized.

 OnDropFiles

 Occurs when user tries to drag and drop a file from explorer to a form. More info.

 OnShow

 Occurs when the form is shown (that is, when its Visible property is set to true).