Class \Prado\Web\UI\WebControls\TWebControl
TWebControl is the base class for controls that share a common set of UI-related properties and methods. TWebControl-derived controls are usually associated with HTML tags. They thus have tag name, attributes and body contents. You can override getTagName to specify the tag name, addAttributesToRender to specify the attributes to be rendered, and renderContents to customize the body content rendering. TWebControl encapsulates a set of properties related with CSS style fields, such as \Prado\Web\UI\WebControls\getBackColor, \Prado\Web\UI\WebControls\getBorderWidth, etc.
Subclasses of TWebControl typically needs to override addAttributesToRender and renderContents. The former is used to render the attributes of the HTML tag associated with the control, while the latter is to render the body contents enclosed within the HTML tag.
Class hierarchy
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
copyBaseAttributes(TWebControl $control) : mixed
Copies basic control attributes from another control.
Properties including AccessKey, ToolTip, TabIndex, Enabled and Attributes are copied. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
onPreRender(TEventParameter $param) : mixed
If your subclass overrides the onPreRender method be sure to call
this method through parent::onPreRender($param); so your sub-class can be decorated,
among other things.
|
public
|
render(THtmlWriter $writer) : mixed
Renders the control.
This method overrides the parent implementation by replacing it with the following sequence:
|
public
|
renderBeginTag(THtmlWriter $writer) : mixed
Renders the openning tag for the control (including attributes)
|
public
|
renderContents(THtmlWriter $writer) : mixed
Renders the body content enclosed between the control tag.
By default, child controls and text strings will be rendered. You can override this method to provide customized content rendering. |
public
|
|
public
|
setAccessKey(string $value) : mixed
Sets the access key of the control.
Only one-character string can be set, or an exception will be raised. Pass in an empty string if you want to disable access key. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setEnsureId(bool $value) : mixed
Subclasses can override getEnsureId or just set this property. eg. If your subclass
control does work with javascript and your class wants to flag that it requires an id
to operate properly. Once set to true, it stays that way.
|
public
|
|
public
|
|
public
|
setStyle(string $value) : mixed
Sets the css style string of the control.
The style string will be prefixed to the styles set via other control properties (e.g. Height, Width). |
public
|
setTabIndex(int $value) : mixed
Sets the tab index of the control.
Pass 0 if you want to disable tab index. |
public
|
setToolTip(string $value) : mixed
Sets the tooltip of the control.
Pass an empty string if you want to disable tooltip. |
public
|
|
protected
|
addAttributesToRender(THtmlWriter $writer) : mixed
Adds attribute name-value pairs to renderer.
By default, the method will render 'id', 'accesskey', 'disabled', 'tabindex', 'title' and all custom attributes. The method can be overriden to provide customized attribute rendering. |
protected
|
createStyle() : TStyle
Creates a style object to be used by the control.
This method may be overriden by controls to provide customized style. |
protected
|
getTagName() : string
Returns the tag name used for this control.
By default, the tag name is 'span'. You can override this method to provide customized tag names. |