Ephox Home Page Ephox Home Page  
Search
Buy/Upgrade
 
 Developers
Developers Home
EditLive! for Java
EditLive! for Windows
System Requirements
Getting Started
Integration Samples
Articles
API Reference
EditLive! for XML
Discussion Forums

AddToolbarButton Method

Adds a custom toolbar button to the end of the specified toolbar.

Applies To

EditLive Object

Syntax

JavaScript object.addToolbarButton( strToolbarName, strButtonKey, strButtonImageURL, strButtonTooltip);
 

Parameters

strToolbarName Required. String that specifies the name of the toolbar to add the button to. Can be either "Command" or "Format".
strButtonKey Required. String that specifies the unique key for your button. This unique key can be used in your event handler.
strButtonImageURL Required. String that specifies the absolute URL of the button image to use in the toolbar.
strButtonTooltip Required. String that specifies the the button's tooltip

Examples

JavaScript

The following example would add a "myOpen" button to the Command (top) toolbar.

<script language="JavaScript">
<!--

EditLiveGlobal.setDownloadDirectory("editlive/");

//Instatiate the EditLiveObject
var editLive1 = new EditLive("Plugin1", 600, 300);

//Assign a JavaScript handler for the EditLive onload event
editLive1.onload = EditLive1_onload;

//Assign a JavaScript handler for the EditLive ontoolbarbuttonclick event
editLive1.ontoolbarbuttonclick = EditLive1_ontoolbarbuttonclick;


//Use this function for setting up EditLive! and assigning variables
function EditLive1_onload()
{
   editLive1.setEditLiveMode('HTMLString');
   editLive1.setSource('<p>Sample content</p>');
   editLive1.addToolbarButton("Command","myOpen","http://www.ephox.com/images/open.gif","Open Tooltip");
}


function EditLive1_ontoolbarbuttonclick(strButtonName){
   if (strButtonName == "myOpen")
   {
      alert("The user clicked the custom button myOpen");
   }
   else
   {
      //The user clicked some other button
      alert(strButtonName);
   }
}


//-->
</script>

Remarks

The button will be added to the end of the specified toolbar.

From version 3.0, new toolbars can be created with this method.  To add the item to a default toolbar, use one of the default toolbar names:

  • Command
  • Format
  • Table

The location of the toolbar button image must be an absolute URL.

Minimum Version

EditLive! 2.1 or greater

See Also

 

 

Copyright © 1999-2005 Ephox Corporation. All Rights Reserved. 'Ephox' is a registered trademark of Ephox Corporation.
Java and the Java Powered logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.