|
Class TImageButton
TImageButton class
TImageButton creates an image button on the page. It is used to submit data
to a page. You can create either a submit button or a command
button.
A command button has a command name (specified by the setCommandName CommandName property) and and a command parameter (specified by
setCommandParameter CommandParameter property) associated with the
button. This allows you to create multiple TLinkButton components on a Web page
and programmatically determine which one is clicked with what parameter. You can
provide an event handler for onCommand OnCommand event to
programmatically control the actions performed when the command button is
clicked. In the event handler, you can determine the setCommandName
CommandName property value and the setCommandParameter CommandParameter
property value through the TCommandParameter::getName Name and TCommandParameter::getParameter Parameter properties of the event parameter
which is of type TCommandEventParameter .
A submit button does not have a command name associated with the
button and clicking on it simply posts the Web page back to the server. By
default, a TImageButton control is a submit button. You can provide an event
handler for the onClick OnClick event to programmatically control the
actions performed when the submit button is clicked. The coordinates of the
clicking point can be obtained from the onClick OnClick event parameter,
which is of type TImageClickEventParameter .
Clicking on button can trigger form validation, if setCausesValidation
CausesValidation is true. And the validation may be restricted within a certain
group of validator controls by setting setValidationGroup
ValidationGroup property. If validation is successful, the data will be post
back to the same page.
TImageButton displays the setText Text property as the hint text to
the displayed image.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TImage
implements
IDataRenderer
-
TImageButton
implements
IPostBackDataHandler,
IPostBackEventHandler,
IButtonControl
Methods summary
protected
string
|
#
getTagName( )
Returns
string tag name of the button
Overrides
|
public
boolean
|
#
getEnableClientScript( )
Returns
boolean whether to render javascript.
|
public
|
#
setEnableClientScript( boolean $value )
Parameters
- $value
boolean whether to render javascript.
|
protected
|
#
addAttributesToRender( THtmlWriter $writer )
Adds attribute name-value pairs to renderer. This overrides the parent
implementation with additional button specific attributes.
Adds attribute name-value pairs to renderer. This overrides the parent
implementation with additional button specific attributes.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
protected
|
#
renderClientControlScript( mixed $writer )
Renders the client-script code.
Renders the client-script code.
|
protected
string
|
#
getClientClassName( )
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Returns
string the javascript class name
|
protected
boolean
|
#
canCauseValidation( )
Returns
boolean whether to perform validation if the button is clicked
|
public
|
#
setIsDefaultButton( boolean $value )
Parameters
- $value
boolean set by a panel to register this button as the default button for the panel.
Implementation of
|
public
boolean
|
#
getIsDefaultButton( )
Returns
boolean true if this button is registered as a default button for a panel.
Implementation of
|
protected
boolean
|
#
needPostBackScript( )
Returns
boolean whether the button needs javascript to do postback
|
protected
array
|
#
getPostBackOptions( )
Returns postback specifications for the button. This method is used by
framework and control developers.
Returns postback specifications for the button. This method is used by
framework and control developers.
Returns
array parameters about how the button defines its postback behavior.
|
public
boolean
|
#
loadPostData( string $key, array $values )
This method checks if the TImageButton is clicked and loads the coordinates
of the clicking position. This method is primarly used by framework
developers.
This method checks if the TImageButton is clicked and loads the coordinates
of the clicking position. This method is primarly used by framework
developers.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
boolean whether the data of the component has been changed
Implementation of
|
public
|
#
raisePostDataChangedEvent( )
A dummy implementation for the IPostBackDataHandler interface.
A dummy implementation for the IPostBackDataHandler interface.
Implementation of
|
public
|
#
onClick( TImageClickEventParameter $param )
This method is invoked when the button is clicked. The method raises
'OnClick' event to fire up the event handlers. If you override this method, be
sure to call the parent implementation so that the event handler can be
invoked.
This method is invoked when the button is clicked. The method raises
'OnClick' event to fire up the event handlers. If you override this method, be
sure to call the parent implementation so that the event handler can be
invoked.
Parameters
Implementation of
|
public
|
#
onCommand( TCommandEventParameter $param )
This method is invoked when the button is clicked. The method raises
'OnCommand' event to fire up the event handlers. 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 button is clicked. The method raises
'OnCommand' event to fire up the event handlers. If you override this method, be
sure to call the parent implementation so that the event handlers can be
invoked.
Parameters
Implementation of
|
public
|
#
raisePostBackEvent( TEventParameter $param )
Raises the postback event. This method is required by IPostBackEventHandler interface. If getCausesValidation
CausesValidation is true, it will invoke the page's TPage::validate
validate method first. It will raise onClick OnClick and onCommand OnCommand events. This method is mainly used by framework and control
developers.
Raises the postback event. This method is required by IPostBackEventHandler interface. If getCausesValidation
CausesValidation is true, it will invoke the page's TPage::validate
validate method first. It will raise onClick OnClick and onCommand OnCommand events. This method is mainly used by framework and control
developers.
Parameters
Implementation of
|
public
boolean
|
#
getDataChanged( )
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns
boolean whether postback has caused the control data change. False if the page is not in
postback mode.
Implementation of
|
public
boolean
|
#
getCausesValidation( )
Returns
boolean whether postback event trigger by this button will cause input validation,
default is true
Implementation of
|
public
|
#
setCausesValidation( boolean $value )
Parameters
- $value
boolean whether postback event trigger by this button will cause input validation
Implementation of
|
public
string
|
#
getCommandName( )
Returns
string the command name associated with the onCommand OnCommand event.
Implementation of
|
public
|
#
setCommandName( string $value )
Parameters
- $value
string the command name associated with the onCommand OnCommand event.
Implementation of
|
public
string
|
#
getCommandParameter( )
Returns
string the parameter associated with the onCommand OnCommand event
Implementation of
|
public
|
#
setCommandParameter( string $value )
Parameters
- $value
string the parameter associated with the onCommand OnCommand event.
Implementation of
|
public
string
|
#
getValidationGroup( )
Returns
string the group of validators which the button causes validation upon postback
Implementation of
|
public
|
#
setValidationGroup( string $value )
Parameters
- $value
string the group of validators which the button causes validation upon postback
Implementation of
|
public
string
|
#
getText( )
Returns
string caption of the button
Implementation of
|
public
|
#
setText( string $value )
Parameters
- $value
string caption of the button
Implementation of
|
public
|
#
onPreRender( mixed $param )
Registers the image button to receive postback data during postback. This is
necessary because an image button, when postback, does not have direct mapping
between post data and the image button name. This method overrides the parent
implementation and is invoked before render.
Registers the image button to receive postback data during postback. This is
necessary because an image button, when postback, does not have direct mapping
between post data and the image button name. This method overrides the parent
implementation and is invoked before render.
Parameters
- $param
mixed event parameter
Overrides
|
public
|
#
renderContents( THtmlWriter $writer )
Renders the body content enclosed between the control tag. This overrides the
parent implementation with nothing to be rendered.
Renders the body content enclosed between the control tag. This overrides the
parent implementation with nothing to be rendered.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
Methods inherited from TWebControl
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getCssClass(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
render(),
renderBeginTag(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__construct(),
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
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 inherited from TControl
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID
|
|