The first thing you want to do is edit the config.js file in the de folder. If you are using DevEdit NX 1.9.2.4, you'll be looking for the common.js file. On line 67, you'll see this:
['Fontname','Fontsize','Formatblock','Styles','-','Fontcolor','Highlight','-','Table','-','Form','-','Flash','Image','Media','-','Inserttextbox','HR','Insertchars','Pageproperties','Clearcode','Custominsert','Toggleposition','Showborders']
These are the toolbar buttons. Let's add one called NewButton. Change line 67 to this:
['Fontname','Fontsize','Formatblock','Styles','-','Fontcolor','Highlight','-','Table','-','Form','-','Flash','Image','Media','-','Inserttextbox','HR','Insertchars','Pageproperties','Clearcode','Custominsert','Toggleposition','Showborders','-','NewButton']
Now open common.js and add this line at the bottom of all the case statements (around line 2027):
case 'NewButton': item = new ToolbarButton( 'NewButton', 'New Button' ) ; break;
You'll need to create a button called newbutton.gif and put it in the de/skins/default folder.
Next, we need to add the command. Add this line after line 2050:
c["NewButton"] = new NewButton();
Now add this code to the bottom of the common.js file:
// NewButton command
var NewButton = function(){
this.Name = 'NewButton' ;
}
NewButton.prototype.execute = function(word)
{
alert("Test");
}
ReplaceWord.prototype.getMode = function(){return OFF;}
The alert("Test"); part of the code is where you would put the JavaScript you want to execute. For information on the JavaScript API, see this link:
http://www.interspire.com/devedit/documentation.php

The article has been updated successfully.