The SubForm control allows the insertion of Forms within other Forms. This allows the creation of complex and sophisticated views through the creation of smaller and simpler parts which are then combined. As well as a blank Subform (one with no designated form), there are also thumbnails of the forms that already exist in the project which means you could place a subform with a designated form.


new-subform32.png Key properties: Form, Can Grow, Can Shrink
Key events:
Server Code: SubForm = Class(TWebSubDocument)
Browser Code: SubForm = Class(Container)


Properties

Property Description
Can Grow The CanGrow property determines the behavior when the Caption text is too large to fit into the Control:
  • if CanGrow=No, the Control retains its design-time height
  • if CanGrow=Scroll, the Control retains its design-time height, but allows the end user to scroll through the text
  • if CanGrow=Yes, the Control increases its height to accommodate the text
Can Shrink The CanShrink property determines the behavior when the Caption text is too small to completely fill the Control:
  • if CanShrink=False, the Control maintains its design-time height
  • if CanShrink=True, the Control decreases its height to accommodate the text Note: enabling CanShrink has no effect unless CanGrow is also enabled. Using this property only makes sense if the control will contain data bound controls. If there is only a small amount of content to be displayed within the control, its height will be reduced so that it elegantly displays the content without leaving large blank areas in the page. More information on how controls can grow and shrink at runtime is available under the topic Plastic Layout.
Form The Form property of the SubForm control allows the SubForm to be statically bound to a specific Form. If a Form is assigned to this property, this Form will be loaded automatically into the SubForm at runtine, without the need of any commands being added to the application's code.
Form Buffer Limit The FormBufferLimit property specifies the maximum number of previously opened forms cached inside the Subform.
Height The Height property specifies the vertical extent of the Control. Note: if the CanGrow or CanShrink properties are set, the actual height of the Control at run time may be different.
Hint The Hint property, if set, specifies the text of a tooltip that is displayed when the user moves the cursor over the control.
Horizontal Placement The HorizontalPlacement property, if set, governs how the Control adjusts its size and position in response to changes in the horizontal dimensions of its parent.
Left The Left property specifies the horizontal position of the Control in the form.
Margins The Margins property clears an area around control (outside its border).
Name The Name property specifies the identifier used to reference the control from browser- or server-side code.
Opacity The Opacity property determines the extent to which the Control obscures any controls placed in its background. A value of 0 means that background controls are fully visible, whereas a value of 100 means that background controls are completely obscured.
Parameters The Parameters property specifies parameter values for the Form hosted in the control. The parameters are written in the same format as the third parameter of the OpenForm function.
Shared Style The SharedStyle property can be used to force several controls always have the same appearance.
Tag The Tag property is used to store user data that is associated with the control.
Top The Top property specifies the vertical position of the Control in the form.
Vertical Placement The VerticalPlacement property, if set, governs how the Rectangle adjusts its size and position in response to changes in the vertical dimensions of its parent.
Visible The visible property is used to make controls visible or invisible. Invisible controls are frequently used to allow for easy access to information from a database table field, if the control is bound to one.
Width The Width property specifies the horizontal extent of the Form/control.

Events (browser-side)

Event Description
On After Grow Or Shrink This event is fired within the browser after the height of a control is adjusted in order to fit its new content.
On Before Grow Or Shrink This event is fired within the browser before the height of a control is adjusted in order to fit its new content.
On Hyperlink Click This event is fired in the browser just after a hyperlink is clicked and before the requested navigation is carried out.

   

Events (server-side)

Event Description
On After Print This event is fired on the server by a Control after its HTML (or in the case of Report generation, PDF) content is generated.
On Before Print This event is fired by a control on the server before control’s HTML (or in the case of Report generation, PDF) content is generated.
On Print Style This event is fired on the server to allow for CSS style changes when the HTML representation of a control is being constructed.

   

Remarks

Run-time behavior

Form opening requires a round-trip to the server to get associated Javascript and HTML. To improve performance form that is currently visible within a Subform is not getting destroyed when new form is opened in the same Subform; it's cached instead and may be reused later on. Form opening mechanism checks Subform cache first and if there is a form matching name and parameters of the form to be opened it becomes active without making any additional request to the server. Amount of forms in the cache is controlled by Form Buffer Limit property.

How Do I: Use Morfik Subforms?

This is a general overview of Morfik Subforms. You will see how Subforms allow you to break the complex pages into smaller and more manageable and independently functioning Forms. An example of how a submform can be used for multiple forms is also shown.


The player will show in this paragraph

Morfik Subforms

Related Topics