Returns tool so for the purposes of client-side manipulation.
|
function GetToolByName (name) |
The example below will show you how to implement an adaptive custom button that will be highlighted when an image in the content area is selected. When the image is not selected the button will be disabled:
| ToosFile.xml |
Copy Code |
|
... <tool name="MyCustomImageDialog" IconUrl="~/RadControls/Editor/Skins/Default/buttons/ImageManager.gif" /> ... |
| ASPX |
Copy Code |
|
<script type="text/javascript"> function OnClientLoad(editor) { editor.AttachEventHandler ("RADEVENT_SEL_CHANGED", function (e) { var selElem = editor.GetSelection().GetParentElement(); //return the currently selected object in the content area var oTool = editor.GetToolByName("MyCustomImageDialog"); //get a reference to the custom tool if (selElem.tagName == "IMG") //if the selected element is of image type, make the tool's icon active { oTool.SetState(0); //Enable Tool Icon } else { oTool.SetState(-1); //Disable Tool Icon } } ); } </script> <rad:radEditor id="RadEditor1" OnClientLoad="OnClientLoad" ImagesPaths="~/Images" UploadImagesPaths="~/Images" runat="server"></rad:radEditor> |