A subclassed Form which behaves as a non-mdi form. A subform can be a child of a form or another subform object.

Syntax

[<oRef> =] new SubForm(<parent oRef>[<title expC>])

<oRef>

A variable or property in which to store a reference to the newly created SubForm object.

<parent oRef>

A variable or property containing an object reference to the form, or subform, that is to be the parent of the new subform. Determines the read-only value of the subform's parent property.

<title expC>

An optional title for the SubForm object. If not specified, the title will be "SubForm".

Properties

The following tables list the properties, events, and methods of the SubForm class.

Property

Default

Description

activeControl

 

The currently active control

allowDrop

false

Whether dragged objects can be dropped on the subform's surface

autoCenter

false

Whether the form automatically centers on-screen when it is opened

autoSize

false

Whether the form automatically sizes itself to display all its components

background

 

Background image

baseClassName

SUBFORM

Identifies the object as an instance of the SubForm class

className

(SUBFORM)

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

clientEdge

false

Whether the edge of the form has the sunken client appearance

colorNormal

BtnFace

Background color

elements

 

An array containing object references to the components on the subform

escExit

true

Whether pressing Esc closes the subform

first

 

The first component on the subform in the z-order

hWndClient

 

The Windows handle for the subform's client area

icon

 

An icon file or resources that displays when the subform is minimized

inDesign

 

Whether the subform was instantiated by the Form designer

maximize

true

Whether the subform can be maximized when not MDI

metric

Chars

Units of measurement (0=Chars, 1=Twips, 2=Points, 3=Inches, 4=Centimeters, 5=Millimeters, 6=Pixels)

minimize

true

Whether the subform can be minimized when not MDI

moveable

true

Whether the subform is moveable when not MDI

nextObj

 

The object that’s about to receive focus

persistent

false

Determines whether custom control, datamodule, menu or procedure files associated with a subform are loaded in the persistent mode.

popupMenu

 

The subform’s Popup menu object

refreshAlways

true

Whether to refresh the subform after all form-based navigation and updates

rowset

 

The primary rowset

scrollBar

Off

When a scroll bar appears for the subform (0=Off, 1=On, 2=Auto, 3=Disabled)

scrollHOffset

 

The current position of the horizontal scrollbar in units matching the form or subform's current metric property

scrollVOffset

 

The current position of the vertical scrollbar in units matching the form or subform's current metric property

showSpeedTip

true

Whether to show tool tips

sizeable

true

Whether the subform is resizeable when not MDI

smallTitle

false

Whether the subform has the smaller palette-style title bar when not MDI

sysMenu

true

Whether the subform’s system menu icon and close icon are displayed when not MDI

text

 

The text that appears in the subform’s title bar

topMost

false

Whether the subform stays on top when not MDI

useTablePopup

false

Whether to use the default table navigation popup when no popup is assigned as the subform’s popupMenu.

view

 

The query or table on which the subform is based

windowState

Normal

The state of the window (0=Normal, 1=Minimized, 2=Maximized)

 

Event

Parameters

Description

canClose

 

When attempting to close subform; return value allows or disallows closure

canNavigate

<workarea expN>

When attempting to navigate in work area; return value allows or disallows leaving current record

onAppend

 

After a new record is added

onChange

<workarea expN>

After leaving a record that was changed, before onNavigate

onClose

 

After the subform has been closed

onDragEnter

<left expN>
<top expN>
<type expC>
<name expC>

When the mouse enters the subform's display area during a Drag&Drop operation

onDragLeave

 

When the mouse leaves the subform's display area without having dropped an object

onDragOver

<left expN>
<top expN>
<type expC>
<name expC>

While the mouse drags an object over the subform's display area during a Drag&Drop operation

onDrop

<left expN>
<top expN>
<type expC>
<name expC>

When the mouse button is released over the subform's display area during a Drag&Drop operation

onMove

 

After the subform has been moved

onNavigate

<workarea expN>

After navigation in a work area

onSelection

<control ID expN>

After the subform is submitted

onSize

<expN>

After the subform is resized or changes windowState

 

Method

Parameters

Description

abandonRecord( )

 

Abandons changes to the current record

beginAppend( )

 

Starts append of new record

close( )

 

Closes the subform

isRecordChanged( )

 

Checks whether the current record buffer has changed

open( )

 

Loads and opens the subform

pageCount( )

 

Returns the highest pageNo of any component

print( )

 

Prints the subform

refresh( )

 

Redraws the subform

saveRecord( )

 

Saves changes to the current or new record

scroll( )

<horizontal expN>, <vertical expN>

Programatically scrolls the client area (the contents) of a subform

showFormatBar( )

<expL>

Displays or hides the formatting toolbar

 

The following table lists the common properties, events, and methods of the SubForm class:

Property

 

Event

 

Method

enabled
height

helpFile

helpId

hWnd

left

mousePointer

pageNo
parent

statusMessage

systemTheme

top

visible

width

beforeRelease
onClose
onDesignOpen

onGotFocus

onHelp

onLeftDblClick

onLeftMouseDown

onLeftMouseUp

onLostFocus

onMiddleDblClick

onMiddleMouseDown
onMiddleMouseUp

onMouseMove

onMouseOut

onMouseOver

onOpen

onRightDblClick

onRightMouseDown

onRightMouseUp
move( )

release( )

setFocus( )

Description

Parenting the subform to a form, or another subform, restricts display of the subform to within the client area of the parent form. When a parent form is closed, it allows the parent form to also close the subform.

A form or subform, containing one or more subforms, internally tracks which subform (if any) is currently active. When a subform is active, that subform has focus. When a form object is given focus, the active subform will lose focus and be set to inactive. Clicking on a subform, or subform object, will activate the subform and set focus either to the subform or the selected object.

A form's canClose event will call the canClose event of any child subforms. If a subform's canClose event returns false, the form's canClose event will also return false.

Subforms are not currently supported by the Form Designer. However, you can design a form in the Form Designer and edit the streamed code to designate it a Subform.