PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TControl

TControl class

TControl is the base class for all components on a page hierarchy. It implements the following features for UI-related functionalities:

  • databinding feature
  • parent and child relationship
  • naming container and containee relationship
  • viewstate and controlstate features
  • rendering scheme
  • control lifecycles

A property can be data-bound with an expression. By calling TControl::dataBind(), expressions bound to properties will be evaluated and the results will be set to the corresponding properties.

Parent and child relationship determines how the presentation of controls are enclosed within each other. A parent will determine where to place the presentation of its child controls. For example, a TPanel will enclose all its child controls' presentation within a div html tag. A control's parent can be obtained via getParent Parent property, and its getControls Controls property returns a list of the control's children, including controls and static texts. The property can be manipulated like an array for adding or removing a child (see TList for more details).

A naming container control implements INamingContainer and ensures that its containee controls can be differentiated by their ID property values. Naming container and containee realtionship specifies a protocol to uniquely identify an arbitrary control on a page hierarchy by an ID path (concatenation of all naming containers' IDs and the target control's ID).

Viewstate and controlstate are two approaches to preserve state across page postback requests. ViewState is mainly related with UI specific state and can be disabled if not needed. ControlState represents crucial logic state and cannot be disabled.

A control is rendered via its TControl::render() method (the method is invoked by the framework.) Descendant control classes may override this method for customized rendering. By default, TControl::render() invokes TControl::renderChildren() which is responsible for rendering of children of the control. Control's getVisible Visible property governs whether the control should be rendered or not.

Each control on a page will undergo a series of lifecycles, including control construction, Init, Load, PreRender, Render, and OnUnload. They work together with page lifecycles to process a page request.

TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable

Direct known subclasses

TCallback, TCallbackOptions, TForm, THead, THiddenField, TI18NControl, TLiteral, TMultiView, TOutputCache, TPlaceHolder, TRepeaterItem, TSafeHtml, TClientScript, TStatements, TStyleSheet, TTranslateParameter, TView, TWebControl, TWizardNavigationContainer, TXmlTransform, TCompositeControl, TConditional, TContent, TContentPlaceHolder, TDataSourceControl, TExpression, TFlushOutput

Indirect known subclasses

TAccordion, TAccordionView, TActiveDatePicker, TRequiredFieldValidator, TScaffoldBase, TScaffoldEditView, TScaffoldListView, TScaffoldSearch, TScaffoldView, TSlider, TTable, TTableCell, TTableFooterRow, TActiveDropDownList, TTableHeaderCell, TTableHeaderRow, TTableRow, TTabPanel, TTabView, TTemplateControl, TTemplateControlInheritable, TTemplatedWizardStep, TTextBox, TTextHighlighter, TActiveFileUpload, TTextProcessor, TTimeTriggeredCallback, TTranslate, TTriggeredCallback, TValidationSummary, TValueTriggeredCallback, TWizard, TWizardStep, TWsatGenerateAR, TWsatHome, TActiveHiddenField, TWsatLayout, TWsatLogin, TWsatScaffolding, TActiveHyperLink, TActiveImage, TActiveImageButton, TActiveLabel, TActiveLinkButton, TActiveListBox, TActiveButton, TActiveMultiView, TActivePager, TActivePanel, TActiveRadioButton, TActiveRadioButtonList, TActiveRatingList, TActiveRepeater, TActiveTableCell, TActiveTableRow, TActiveTextBox, TActiveCheckBox, TAutoComplete, TBaseDataList, TBaseValidator, TBulletedList, TButton, TCaptcha, TCaptchaValidator, TCheckBox, TCheckBoxList, TChoiceFormat, TActiveCheckBoxList, TColorPicker, TCompareValidator, TCompleteWizardStep, TCustomValidator, TDataBoundControl, TDataGrid, TDataGridItem, TDataGridItemRenderer, TDataGridPager, TDataList, TActiveClientScript, TDataListItem, TDataListItemRenderer, TDataRenderer, TDataTypeValidator, TDateFormat, TDatePicker, TDraggable, TDropContainer, TDropDownList, TEmailAddressValidator, TActiveCustomValidator, TEventTriggeredCallback, TFileUpload, THeader1, THeader2, THeader3, THeader4, THeader5, THeader6, THtmlArea, THtmlArea4, TActiveDataGrid, THtmlElement, THyperLink, TImage, TImageButton, TImageMap, TInlineFrame, TInPlaceTextBox, TItemDataRenderer, TJavascriptLogger, TKeyboard, TActiveDataGridPager, TLabel, TLinkButton, TListBox, TListControl, TListControlValidator, TMarkdown, TNumberFormat, TPage, TPager, TPanel, TActiveDataList, TRadioButton, TRadioButtonList, TRangeValidator, TRatingList, TReadOnlyDataSource, TReCaptcha, TReCaptchaValidator, TRegularExpressionValidator, TRepeater, TRepeaterItemRenderer
Package: System\Web\UI
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Web/UI/TControl.php
Methods summary
public
# __construct( )

Constructor.

Constructor.

Overrides

TComponent::__construct()
public mixed
# __get( string $name )

Returns a property value by name or a control by ID. This overrides the parent implementation by allowing accessing a control via its ID using the following syntax,

$menuBar=$this->menuBar;

Note, the control must be configured in the template with explicit ID. If the name matches both a property and a control ID, the control ID will take the precedence.

Returns a property value by name or a control by ID. This overrides the parent implementation by allowing accessing a control via its ID using the following syntax,

$menuBar=$this->menuBar;

Note, the control must be configured in the template with explicit ID. If the name matches both a property and a control ID, the control ID will take the precedence.

Parameters

$name
string
the property name or control ID

Returns

mixed
the property value or the target control

Throws

TInvalidOperationException
if the property is not defined.

See

TControl::registerObject()

Overrides

TComponent::__get()
public boolean
# getHasAdapter( )

Returns

boolean
whether there is an adapter for this control
public TControlAdapter
# getAdapter( )

Returns

TControlAdapter
control adapter. Null if not exists.
public
# setAdapter( TControlAdapter $adapter )

Parameters

$adapter
TControlAdapter
control adapter
public TControl
# getParent( )

Returns

TControl
the parent of this control
public TControl
# getNamingContainer( )

Returns

TControl
the naming container of this control
public TPage
# getPage( )

Returns

TPage
the page that contains this control
public
# setPage( TPage $page )

Sets the page for a control. Only framework developers should use this method.

Sets the page for a control. Only framework developers should use this method.

Parameters

$page
TPage
the page that contains this control
public
# setTemplateControl( TTemplateControl $control )

Sets the control whose template contains this control. Only framework developers should use this method.

Sets the control whose template contains this control. Only framework developers should use this method.

Parameters

$control
TTemplateControl
the control whose template contains this control
public TTemplateControl
# getTemplateControl( )

Returns

TTemplateControl
the control whose template contains this control
public TTemplateControl
# getSourceTemplateControl( )

Returns

TTemplateControl
the control whose template is loaded from some external storage, such as file, db, and whose template ultimately contains this control.
protected integer
# getControlStage( )

Gets the lifecycle step the control is currently at. This method should only be used by control developers.

Gets the lifecycle step the control is currently at. This method should only be used by control developers.

Returns

integer
the lifecycle step the control is currently at. The value can be CS_CONSTRUCTED, CS_CHILD_INITIALIZED, CS_INITIALIZED, CS_STATE_LOADED, CS_LOADED, CS_PRERENDERED.
protected
# setControlStage( integer $value )

Sets the lifecycle step the control is currently at. This method should only be used by control developers.

Sets the lifecycle step the control is currently at. This method should only be used by control developers.

Parameters

$value
integer
the lifecycle step the control is currently at. Valid values include CS_CONSTRUCTED, CS_CHILD_INITIALIZED, CS_INITIALIZED, CS_STATE_LOADED, CS_LOADED, CS_PRERENDERED.
public string
# getID( boolean $hideAutoID = true )

Returns the id of the control. Control ID can be either manually set or automatically generated. If $hideAutoID is true, automatically generated ID will be returned as an empty string.

Returns the id of the control. Control ID can be either manually set or automatically generated. If $hideAutoID is true, automatically generated ID will be returned as an empty string.

Parameters

$hideAutoID
boolean
whether to hide automatically generated ID

Returns

string
the ID of the control
public
# setID( string $id )

Parameters

$id
string
the new control ID. The value must consist of word characters [a-zA-Z0-9_] only

Throws

TInvalidDataValueException
if ID is in a bad format
public string
# getUniqueID( )

Returns a unique ID that identifies the control in the page hierarchy. A unique ID is the contenation of all naming container controls' IDs and the control ID. These IDs are separated by '$' character. Control users should not rely on the specific format of UniqueID, however.

Returns a unique ID that identifies the control in the page hierarchy. A unique ID is the contenation of all naming container controls' IDs and the control ID. These IDs are separated by '$' character. Control users should not rely on the specific format of UniqueID, however.

Returns

string
a unique ID that identifies the control in the page hierarchy
public
# focus( )

Sets input focus to this control.

Sets input focus to this control.

public string
# getClientID( )

Returns the client ID of the control. The client ID can be used to uniquely identify the control in client-side scripts (such as JavaScript). Do not rely on the explicit format of the return ID.

Returns the client ID of the control. The client ID can be used to uniquely identify the control in client-side scripts (such as JavaScript). Do not rely on the explicit format of the return ID.

Returns

string
the client ID of the control
public static string
# convertUniqueIdToClientId( string $uniqueID )

Converts a unique ID to a client ID.

Converts a unique ID to a client ID.

Parameters

$uniqueID
string
the unique ID of a control

Returns

string
the client ID of the control
public string
# getSkinID( )

Returns

string
the skin ID of this control, '' if not set
public
# setSkinID( string $value )

Parameters

$value
string
the skin ID of this control

Throws

TInvalidOperationException
if the SkinID is set in a stage later than PreInit, or if the skin is applied already.
public
# getIsSkinApplied( )

Throws

TInvalidOperationException
if the SkinID is set in a stage later than PreInit, or if the skin is applied already.
public boolean
# getEnableTheming( )

Returns

boolean
whether theming is enabled for this control. The theming is enabled if the control and all its parents have it enabled.
public
# setEnableTheming( boolean $value )

Parameters

$value
boolean
whether to enable theming

Throws

TInvalidOperationException
if this method is invoked after OnPreInit
public mixed
# getCustomData( )

Returns custom data associated with this control. A control may be associated with some custom data for various purposes. For example, a button may be associated with a string to identify itself in a generic OnClick event handler.

Returns custom data associated with this control. A control may be associated with some custom data for various purposes. For example, a button may be associated with a string to identify itself in a generic OnClick event handler.

Returns

mixed
custom data associated with this control. Defaults to null.
public
# setCustomData( mixed $value )

Associates custom data with this control. Note, the custom data must be serializable and unserializable.

Associates custom data with this control. Note, the custom data must be serializable and unserializable.

Parameters

$value
mixed
custom data
public boolean
# getHasControls( )

Returns

boolean
whether the control has child controls
public TControlCollection
# getControls( )

Returns

TControlCollection
the child control collection
protected TControlCollection
# createControlCollection( )

Creates a control collection object that is to be used to hold child controls

Creates a control collection object that is to be used to hold child controls

Returns

TControlCollection
control collection

See

TControl::getControls()
public boolean
# getVisible( boolean $checkParents = true )

Checks if a control is visible. If parent check is required, then a control is visible only if the control and all its ancestors are visible.

Checks if a control is visible. If parent check is required, then a control is visible only if the control and all its ancestors are visible.

Parameters

$checkParents
boolean
whether the parents should also be checked if visible

Returns

boolean
whether the control is visible (default=true).
public
# setVisible( boolean $value )

Parameters

$value
boolean
whether the control is visible
public boolean
# getEnabled( boolean $checkParents = false )

Returns a value indicating whether the control is enabled. A control is enabled if it allows client user interaction. If $checkParents is true, all parent controls will be checked, and unless they are all enabled, false will be returned. The property Enabled is mainly used for TWebControl derived controls.

Returns a value indicating whether the control is enabled. A control is enabled if it allows client user interaction. If $checkParents is true, all parent controls will be checked, and unless they are all enabled, false will be returned. The property Enabled is mainly used for TWebControl derived controls.

Parameters

$checkParents
boolean
whether the parents should also be checked enabled

Returns

boolean
whether the control is enabled.
public
# setEnabled( boolean $value )

Parameters

$value
boolean
whether the control is to be enabled.
public boolean
# getHasAttributes( )

Returns

boolean
whether the control has custom attributes
public TAttributeCollection
# getAttributes( )

Returns the list of custom attributes. Custom attributes are name-value pairs that may be rendered as HTML tags' attributes.

Returns the list of custom attributes. Custom attributes are name-value pairs that may be rendered as HTML tags' attributes.

Returns

TAttributeCollection
the list of custom attributes
public boolean
# hasAttribute( mixed $name )

Returns

boolean
whether the named attribute exists
public string
# getAttribute( mixed $name )

Returns

string
attribute value, null if attribute does not exist
public
# setAttribute( string $name, string $value )

Sets a custom control attribute.

Sets a custom control attribute.

Parameters

$name
string
attribute name
$value
string
value of the attribute
public string
# removeAttribute( string $name )

Removes the named attribute.

Removes the named attribute.

Parameters

$name
string
the name of the attribute to be removed.

Returns

string
attribute value removed, null if attribute does not exist.
public boolean
# getEnableViewState( mixed $checkParents = false )

Returns

boolean
whether viewstate is enabled
public
# setEnableViewState( boolean $value )

Parameters

$value
boolean
set whether to enable viewstate
protected mixed
# getControlState( string $key, mixed $defaultValue = null )

Returns a controlstate value.

Returns a controlstate value.

This function is mainly used in defining getter functions for control properties that must be kept in controlstate.

Parameters

$key
string
the name of the controlstate value to be returned
$defaultValue
mixed
the default value. If $key is not found in controlstate, $defaultValue will be returned

Returns

mixed
the controlstate value corresponding to $key
protected
# setControlState( string $key, mixed $value, mixed $defaultValue = null )

Sets a controlstate value.

Sets a controlstate value.

This function is very useful in defining setter functions for control properties that must be kept in controlstate. Make sure that the controlstate value must be serializable and unserializable.

Parameters

$key
string
the name of the controlstate value
$value
mixed
the controlstate value to be set
$defaultValue
mixed
default value. If $value===$defaultValue, the item will be cleared from controlstate
protected
# clearControlState( string $key )

Clears a controlstate value.

Clears a controlstate value.

Parameters

$key
string
the name of the controlstate value to be cleared
public
# trackViewState( boolean $enabled )

Sets a value indicating whether we should keep data in viewstate. When it is false, data saved via setViewState() will not be persisted. By default, it is true, meaning data will be persisted across postbacks.

Sets a value indicating whether we should keep data in viewstate. When it is false, data saved via setViewState() will not be persisted. By default, it is true, meaning data will be persisted across postbacks.

Parameters

$enabled
boolean
whether data should be persisted
public mixed
# getViewState( string $key, mixed $defaultValue = null )

Returns a viewstate value.

Returns a viewstate value.

This function is very useful in defining getter functions for component properties that must be kept in viewstate.

Parameters

$key
string
the name of the viewstate value to be returned
$defaultValue
mixed
the default value. If $key is not found in viewstate, $defaultValue will be returned

Returns

mixed
the viewstate value corresponding to $key
public
# setViewState( string $key, mixed $value, mixed $defaultValue = null )

Sets a viewstate value.

Sets a viewstate value.

This function is very useful in defining setter functions for control properties that must be kept in viewstate. Make sure that the viewstate value must be serializable and unserializable.

Parameters

$key
string
the name of the viewstate value
$value
mixed
the viewstate value to be set
$defaultValue
mixed
default value. If $value===$defaultValue, the item will be cleared from the viewstate.
public
# clearViewState( string $key )

Clears a viewstate value.

Clears a viewstate value.

Parameters

$key
string
the name of the viewstate value to be cleared
public
# bindProperty( string $name, string $expression )

Sets up the binding between a property (or property path) and an expression. The context of the expression is the template control (or the control itself if it is a page).

Sets up the binding between a property (or property path) and an expression. The context of the expression is the template control (or the control itself if it is a page).

Parameters

$name
string
the property name, or property path
$expression
string
the expression
public
# unbindProperty( string $name )

Breaks the binding between a property (or property path) and an expression.

Breaks the binding between a property (or property path) and an expression.

Parameters

$name
string
the property name (or property path)
public
# autoBindProperty( string $name, string $expression )

Sets up the binding between a property (or property path) and an expression. Unlike regular databinding, the expression bound by this method is automatically evaluated during prerenderRecursive(). The context of the expression is the template control (or the control itself if it is a page).

Sets up the binding between a property (or property path) and an expression. Unlike regular databinding, the expression bound by this method is automatically evaluated during prerenderRecursive(). The context of the expression is the template control (or the control itself if it is a page).

Parameters

$name
string
the property name, or property path
$expression
string
the expression
public
# dataBind( )

Performs the databinding for this control.

Performs the databinding for this control.

Implementation of

IBindable::dataBind()
protected
# dataBindProperties( )

Databinding properties of the control.

Databinding properties of the control.

protected
# autoDataBindProperties( )

Auto databinding properties of the control.

Auto databinding properties of the control.

protected
# dataBindChildren( )

Databinding child controls.

Databinding child controls.

final protected boolean
# getChildControlsCreated( )

Returns

boolean
whether child controls have been created
final protected
# setChildControlsCreated( boolean $value )

Sets a value indicating whether child controls are created. If false, any existing child controls will be cleared up.

Sets a value indicating whether child controls are created. If false, any existing child controls will be cleared up.

Parameters

$value
boolean
whether child controls are created
public
# ensureChildControls( )

Ensures child controls are created. If child controls are not created yet, this method will invoke TControl::createChildControls() to create them.

Ensures child controls are created. If child controls are not created yet, this method will invoke TControl::createChildControls() to create them.

public
# createChildControls( )

Creates child controls. This method can be overriden for controls who want to have their controls. Do not call this method directly. Instead, call TControl::ensureChildControls() to ensure child controls are created only once.

Creates child controls. This method can be overriden for controls who want to have their controls. Do not call this method directly. Instead, call TControl::ensureChildControls() to ensure child controls are created only once.

public TControl|null
# findControl( string $id )

Finds a control by ID path within the current naming container. The current naming container is either the control itself if it implements INamingContainer or the control's naming container. The ID path is an ID sequence separated by TControl::ID_SEPARATOR. For example, 'Repeater1.Item1.Button1' looks for a control with ID 'Button1' whose naming container is 'Item1' whose naming container is 'Repeater1'.

Finds a control by ID path within the current naming container. The current naming container is either the control itself if it implements INamingContainer or the control's naming container. The ID path is an ID sequence separated by TControl::ID_SEPARATOR. For example, 'Repeater1.Item1.Button1' looks for a control with ID 'Button1' whose naming container is 'Item1' whose naming container is 'Repeater1'.

Parameters

$id
string
ID of the control to be looked up

Returns

TControl|null
the control found, null if not found

Throws

TInvalidDataValueException
if a control's ID is found not unique within its naming container.
public array
# findControlsByType( string $type, boolean $strict = true )

Finds all child and grand-child controls that are of the specified type.

Finds all child and grand-child controls that are of the specified type.

Parameters

$type
string
the class name
$strict
boolean
whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned.

Returns

array
list of controls found
public array
# findControlsByID( string $id )

Finds all child and grand-child controls with the specified ID. Note, this method is different from TControl::findControl() in that it searches through all controls that have this control as the ancestor while findcontrol only searches through controls that have this control as the direct naming container.

Finds all child and grand-child controls with the specified ID. Note, this method is different from TControl::findControl() in that it searches through all controls that have this control as the ancestor while findcontrol only searches through controls that have this control as the direct naming container.

Parameters

$id
string
the ID being looked for

Returns

array
list of controls found
public
# clearNamingContainer( )

Resets the control as a naming container. Only framework developers should use this method.

Resets the control as a naming container. Only framework developers should use this method.

public
# registerObject( string $name, object $object )

Registers an object by a name. A registered object can be accessed like a public member variable. This method should only be used by framework and control developers.

Registers an object by a name. A registered object can be accessed like a public member variable. This method should only be used by framework and control developers.

Parameters

$name
string
name of the object
$object
object
object to be declared

See

TControl::__get()
public
# unregisterObject( string $name )

Unregisters an object by name.

Unregisters an object by name.

Parameters

$name
string
name of the object

See

TControl::registerObject()
public boolean
# isObjectRegistered( mixed $name )

Returns

boolean
whether an object has been registered with the name

See

TControl::registerObject()
public boolean
# getHasChildInitialized( )

Returns

boolean
true if the child control has been initialized.
public boolean
# getHasInitialized( )

Returns

boolean
true if the onInit event has raised.
public boolean
# getHasLoadedPostData( )

Returns

boolean
true if the control has loaded post data.
public boolean
# getHasLoaded( )

Returns

boolean
true if the onLoad event has raised.
public boolean
# getHasPreRendered( )

Returns

boolean
true if onPreRender event has raised.
public mixed
# getRegisteredObject( mixed $name )

Returns the named registered object. A component with explicit ID on a template will be registered to the template owner. This method allows you to obtain this component with the ID.

Returns the named registered object. A component with explicit ID on a template will be registered to the template owner. This method allows you to obtain this component with the ID.

Returns

mixed
the named registered object. Null if object is not found.
public boolean
# getAllowChildControls( )

Returns

boolean
whether body contents are allowed for this control. Defaults to true.
public
# addParsedObject( string|TComponent $object )

Adds the object instantiated on a template to the child control collection. This method overrides the parent implementation. Only framework developers and control developers should use this method.

Adds the object instantiated on a template to the child control collection. This method overrides the parent implementation. Only framework developers and control developers should use this method.

Parameters

$object
string|TComponent
text string or component parsed and instantiated in template

See

TComponent::createdOnTemplate()

Overrides

TComponent::addParsedObject()
final protected
# clearChildState( )

Clears up the child state data. After a control loads its state, those state that do not belong to any existing child controls are stored as child state. This method will remove these state. Only frameworker developers and control developers should use this method.

Clears up the child state data. After a control loads its state, those state that do not belong to any existing child controls are stored as child state. This method will remove these state. Only frameworker developers and control developers should use this method.

final protected boolean
# isDescendentOf( TControl $ancestor )

Parameters

$ancestor
TControl
the potential ancestor control

Returns

boolean
if the control is a descendent (parent, parent of parent, etc.) of the specified control
public
# addedControl( TControl $control )

Adds a control into the child collection of the control. Control lifecycles will be caught up during the addition. Only framework developers should use this method.

Adds a control into the child collection of the control. Control lifecycles will be caught up during the addition. Only framework developers should use this method.

Parameters

$control
TControl
the new child control
public
# removedControl( TControl $control )

Removes a control from the child collection of the control. Only framework developers should use this method.

Removes a control from the child collection of the control. Only framework developers should use this method.

Parameters

$control
TControl
the child control removed
protected
# initRecursive( TControl $namingContainer = null )

Performs the Init step for the control and all its child controls. Only framework developers should use this method.

Performs the Init step for the control and all its child controls. Only framework developers should use this method.

Parameters

$namingContainer
TControl
the naming container control
protected
# loadRecursive( )

Performs the Load step for the control and all its child controls. Only framework developers should use this method.

Performs the Load step for the control and all its child controls. Only framework developers should use this method.

protected
# preRenderRecursive( )

Performs the PreRender step for the control and all its child controls. Only framework developers should use this method.

Performs the PreRender step for the control and all its child controls. Only framework developers should use this method.

protected
# addToPostDataLoader( )

Add controls implementing IPostBackDataHandler to post data loaders.

Add controls implementing IPostBackDataHandler to post data loaders.

protected
# unloadRecursive( )

Performs the Unload step for the control and all its child controls. Only framework developers should use this method.

Performs the Unload step for the control and all its child controls. Only framework developers should use this method.

public
# onInit( TEventParameter $param )

This method is invoked when the control enters 'OnInit' stage. The method raises 'OnInit' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

This method is invoked when the control enters 'OnInit' stage. The method raises 'OnInit' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers
public
# onLoad( TEventParameter $param )

This method is invoked when the control enters 'OnLoad' stage. The method raises 'OnLoad' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

This method is invoked when the control enters 'OnLoad' stage. The method raises 'OnLoad' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers
public
# onDataBinding( TEventParameter $param )

Raises 'OnDataBinding' event. This method is invoked when TControl::dataBind() is invoked.

Raises 'OnDataBinding' event. This method is invoked when TControl::dataBind() is invoked.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers
public
# onUnload( TEventParameter $param )

This method is invoked when the control enters 'OnUnload' stage. The method raises 'OnUnload' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

This method is invoked when the control enters 'OnUnload' stage. The method raises 'OnUnload' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers
public
# onPreRender( TEventParameter $param )

This method is invoked when the control enters 'OnPreRender' stage. The method raises 'OnPreRender' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

This method is invoked when the control enters 'OnPreRender' stage. The method raises 'OnPreRender' event. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers
protected
# raiseBubbleEvent( TControl $sender, TEventParameter $param )

Invokes the parent's bubbleEvent method. A control who wants to bubble an event must call this method in its onEvent method.

Invokes the parent's bubbleEvent method. A control who wants to bubble an event must call this method in its onEvent method.

Parameters

$sender
TControl
sender of the event
$param
TEventParameter
event parameter

See

TControl::bubbleEvent()
public boolean
# bubbleEvent( TControl $sender, TEventParameter $param )

This method responds to a bubbled event. This method should be overriden to provide customized response to a bubbled event. Check the type of event parameter to determine what event is bubbled currently.

This method responds to a bubbled event. This method should be overriden to provide customized response to a bubbled event. Check the type of event parameter to determine what event is bubbled currently.

Parameters

$sender
TControl
sender of the event
$param
TEventParameter
event parameters

Returns

boolean
true if the event bubbling is handled and no more bubbling.

See

TControl::raiseBubbleEvent()
public
# broadcastEvent( string $name, TControl $sender, TEventParameter $param )

Broadcasts an event. The event will be sent to all controls on the current page hierarchy. If a control defines the event, the event will be raised for the control. If a control implements IBroadcastEventReceiver, its IBroadcastEventReceiver::broadcastEventReceived broadcastEventReceived() method will be invoked which gives the control a chance to respond to the event. For example, when broadcasting event 'OnClick', all controls having 'OnClick' event will have this event raised, and all controls implementing IBroadcastEventReceiver will also have its IBroadcastEventReceiver::broadcastEventReceived broadcastEventReceived() invoked.

Broadcasts an event. The event will be sent to all controls on the current page hierarchy. If a control defines the event, the event will be raised for the control. If a control implements IBroadcastEventReceiver, its IBroadcastEventReceiver::broadcastEventReceived broadcastEventReceived() method will be invoked which gives the control a chance to respond to the event. For example, when broadcasting event 'OnClick', all controls having 'OnClick' event will have this event raised, and all controls implementing IBroadcastEventReceiver will also have its IBroadcastEventReceiver::broadcastEventReceived broadcastEventReceived() invoked.

Parameters

$name
string
name of the broadcast event
$sender
TControl
sender of this event
$param
TEventParameter
event parameter
protected
# traverseChildControls( mixed $param, callable $preCallback = null, callable $postCallback = null )

Traverse the whole control hierarchy rooted at this control. Callback function may be invoked for each control being visited. A pre-callback is invoked before traversing child controls; A post-callback is invoked after traversing child controls. Callback functions can be global functions or class methods. They must be of the following signature:

function callback_func($control,$param) {...}

where $control refers to the control being visited and $param is the parameter that is passed originally when calling this traverse function.

Traverse the whole control hierarchy rooted at this control. Callback function may be invoked for each control being visited. A pre-callback is invoked before traversing child controls; A post-callback is invoked after traversing child controls. Callback functions can be global functions or class methods. They must be of the following signature:

function callback_func($control,$param) {...}

where $control refers to the control being visited and $param is the parameter that is passed originally when calling this traverse function.

Parameters

$param
mixed
parameter to be passed to callbacks for each control
$preCallback
callable
callback invoked before traversing child controls. If null, it is ignored.
$postCallback
callable
callback invoked after traversing child controls. If null, it is ignored.
public
# renderControl( THtmlWriter $writer )

Renders the control. Only when the control is visible will the control be rendered.

Renders the control. Only when the control is visible will the control be rendered.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose
public
# render( THtmlWriter $writer )

Renders the control. This method is invoked by TControl::renderControl() when the control is visible. You can override this method to provide customized rendering of the control. By default, the control simply renders all its child contents.

Renders the control. This method is invoked by TControl::renderControl() when the control is visible. You can override this method to provide customized rendering of the control. By default, the control simply renders all its child contents.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose

Implementation of

IRenderable::render()
public
# renderChildren( THtmlWriter $writer )

Renders the children of the control. This method iterates through all child controls and static text strings and renders them in order.

Renders the children of the control. This method iterates through all child controls and static text strings and renders them in order.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose
public
# saveState( )

This method is invoked when control state is to be saved. You can override this method to do last step state saving. Parent implementation must be invoked.

This method is invoked when control state is to be saved. You can override this method to do last step state saving. Parent implementation must be invoked.

public
# loadState( )

This method is invoked right after the control has loaded its state. You can override this method to initialize data from the control state. Parent implementation must be invoked.

This method is invoked right after the control has loaded its state. You can override this method to initialize data from the control state. Parent implementation must be invoked.

protected
# loadStateRecursive( array & $state, boolean $needViewState = true )

Loads state (viewstate and controlstate) into a control and its children. This method should only be used by framework developers.

Loads state (viewstate and controlstate) into a control and its children. This method should only be used by framework developers.

Parameters

$state
array
the collection of the state
$needViewState
boolean
whether the viewstate should be loaded
protected array &
# saveStateRecursive( boolean $needViewState = true )

Saves all control state (viewstate and controlstate) as a collection. This method should only be used by framework developers.

Saves all control state (viewstate and controlstate) as a collection. This method should only be used by framework developers.

Parameters

$needViewState
boolean
whether the viewstate should be saved

Returns

array
the collection of the control state (including its children's state).
public
# applyStyleSheetSkin( TPage $page )

Applies a stylesheet skin to a control.

Applies a stylesheet skin to a control.

Parameters

$page
TPage
the page containing the control

Throws

TInvalidOperationException
if the stylesheet skin is applied already
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string ID_FORMAT '/^[a-zA-Z_]\\w*$/'
#

format of control ID

format of control ID

string ID_SEPARATOR '$'
#

separator char between IDs in a UniqueID

separator char between IDs in a UniqueID

string CLIENT_ID_SEPARATOR '_'
#

separator char between IDs in a ClientID

separator char between IDs in a ClientID

string AUTOMATIC_ID_PREFIX 'ctl'
#

prefix to an ID automatically generated

prefix to an ID automatically generated

integer CS_CONSTRUCTED 0
#

the stage of lifecycles that the control is currently at

the stage of lifecycles that the control is currently at

integer CS_CHILD_INITIALIZED 1
#
integer CS_INITIALIZED 2
#
integer CS_STATE_LOADED 3
#
integer CS_LOADED 4
#
integer CS_PRERENDERED 5
#
integer IS_ID_SET 0x01
#

State bits.

State bits.

integer IS_DISABLE_VIEWSTATE 0x02
#
integer IS_SKIN_APPLIED 0x04
#
integer IS_STYLESHEET_APPLIED 0x08
#
integer IS_DISABLE_THEMING 0x10
#
integer IS_CHILD_CREATED 0x20
#
integer IS_CREATING_CHILD 0x40
#
integer RF_CONTROLS 0
#

Indexes for the rare fields. In order to save memory, rare fields will only be created if they are needed.

Indexes for the rare fields. In order to save memory, rare fields will only be created if they are needed.

integer RF_CHILD_STATE 1
#
integer RF_NAMED_CONTROLS 2
#
integer RF_NAMED_CONTROLS_ID 3
#
integer RF_SKIN_ID 4
#
integer RF_DATA_BINDINGS 5
#
integer RF_EVENTS 6
#
integer RF_CONTROLSTATE 7
#
integer RF_NAMED_OBJECTS 8
#
integer RF_ADAPTER 9
#
integer RF_AUTO_BINDINGS 10
#
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO