Methods for the Button Object
The following describes the methods that are available for the Button object. For information about defining the event handler for a button, see Defining an Event Handler for a Button. For information about getting the ID of a title bar or button, see Identifying the IDs of Buttons and TitleBars.
Method Name | Return Type | Chain-able | Description | Sample Code |
---|---|---|---|---|
disable() |
this |
Yes |
Disables the button. |
|
enable() |
this |
Yes |
Enables the button. |
|
getId() |
String |
No |
Returns the ID of the button. You can use the returned ID to find the button again. |
|
getImage() |
String |
No |
Returns the URL to the image that was assigned to the button. |
|
getParent() |
TitleBar |
No |
Returns the parent TitleBar instance of this button. You can call this method to get the parent TitleBar of a known Button and add more buttons to the TitleBar. |
|
getText() |
String |
No |
Returns the text of the button. |
|
getToolTipText() |
String |
No |
Returns the tooltip text of the button. |
|
getToolTipFormat() |
String |
No |
Returns the tooltip format of the button |
|
hide() |
this |
Yes |
Hides the button. |
|
invokeDefault (evt) |
Not applic-able |
No |
Invokes the default event handler for the preconfigured button. This is useful if you want to add additional functionality to a preconfigured button, but then still want to invoke the default event handler. For example, you might want to validate
a form before the record is saved. You can redefine the onclick event
for the Save button to include your own validation logic. After the
validation, you still want to save the record, so you can then call |
|
isDisabled() |
Boolean |
No |
Returns whether the button is currently disabled. |
|
isHidden() |
Boolean |
No |
Returns whether the button is hidden. |
|
off(evt,customFunction) |
this |
Yes |
Removes the registered event listener for the given event. Note: The event handler must be the original event
handler that was used to register the event. For information about how to define the event handler function, see Defining an Event Handler for a Button. |
|
offAll(evt) |
this |
Yes |
Removes all event handlers attached to the Button for the given event. This method is useful when you want to change the default behavior of a button, for example, to remove the default onclick event. |
|
offDefault(evt) |
this |
Yes |
Removes the default event handler for the preconfigured button. Because the event handler for preconfigured buttons is not added by the user, you do not have the reference to the original event handler, and so you cannot remove the event handler by calling the off() method. |
|
on(evt,customFunction, data) |
this |
Yes |
Registers an event handler for the given event type. The data parameter is an optional parameter. It is useful when you want to pass more information to the customFunction. Note: You can use an anonymous function as the event handler. However,
in that case, you cannot remove the event handler unless you call
offAll(), which removes all the registered event handlers for the
given event type. So, if you plan to remove the event handler, then
do not use the anonymous function as the event handler. |
The following sample code uses the optional data parameter:
In this case, the additional data, For a further example of using the on() function, see Defining an Event Handler for a Button. |
setImage(url) |
this |
Yes |
Sets an image for the button. You can use a relative URL or absolute URL for an image. If the URL is null, then the image is removed. |
or
|
setParent(tb) |
this |
Yes |
Sets the given TitleBar as the parent of this button. You can create a button first, without giving it a parent. You can then call this method to add the button to a TitleBar. If a button is already added to a TitleBar, and if you call this method for a different TitleBar, then the calls fails and an alert is displayed. |
|
setText(text) |
this |
Yes |
Sets the text of this button. No text is displayed if a null or empty string is passed. |
|
setToolTipText(tool TipText) |
this |
Yes |
Sets the tooltip text of the button. If a null or empty string is passed, no tooltip is set for this button. Note: If you use oraclecrmod.enableIdHint() in your code, the tooltip
for enableIdHint() is displayed on top of the tooltip text for setToolTipText(). |
|
setToolTipFormat() |
this |
Yes |
Sets the tooltip format of the button, which
can be either HTML or plain text. If a null or empty string is passed,
the format is set as |
For more information about tooltip formatting, see Considerations for Specifying Tooltips with HTML Formatting . |
show() |
this |
Yes |
Shows the button if the button is currently hidden. |
|