This is a migrated thread and some comments may be shown as answers.

Tooltip for InsertTable and InsertForm

5 Answers 36 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Roger Withnell
Top achievements
Rank 1
Roger Withnell asked on 16 Jul 2010, 07:26 PM
I would like to change the tooltip for InsertTable and InsertForm in the ToolsFile.xml.

<tool name="ForeColor" text="Font colour" />

works but

<tool name="InsertTable" text="Table manager" />

or

<EditorToolStrip name="InsertFormElement" text="Form manager" />

do not.

Your help would be much appreciated.

Thanking you in anticipation.

Roger

5 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 20 Jul 2010, 04:18 PM
Hi Roger,

Tools like InsertTable and InsertFormElement are more complex tools, and by design they do not use the Text property. However, you can modify the tooltips of these tools using the following approach:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="InsertTable" Text="blah" ShowText="true" />
            <telerik:EditorTool Name="InsertFormElement" Text="blah" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientLoad(sender, args)
    {
        //get reference to the tool
        var insertTableTool = sender.getToolByName("InsertTable");
        var insertFormTool = sender.getToolByName("InsertFormElement");
        //set title attribute to modify the tooltip
        insertFormTool.get_element().setAttribute("title", "Form manager");
        insertTableTool.get_element().setAttribute("title", "Table manager");
    }
</script>

I hope this helps.

Kind regards,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger Withnell
Top achievements
Rank 1
answered on 20 Jul 2010, 05:42 PM
Thanks for your reply, Dobromir.

Your code works fine, but if I declare ToolbarMode="PageTop" in the RadEditor, I get the error:

'null' is null or not an object

at

insertFormTool.get_element().setAttribute(

"title", "Form manager");

 


Please advise.

Roger

0
Dobromir
Telerik team
answered on 22 Jul 2010, 07:03 PM
Hi Roger,

The reported JavaScript error occurs because RadEditor's tools are not initialized during the OnClientLoad event whenToolbarMode is set to PageTop. For this specific scenario you can use the following code:
<script type="text/javascript">
    function OnClientLoad(sender, args)
    {
        var toolbarWnd = sender.get_toolAdapter().get_window();//get reference to the window containing the toolbar
        function setTitles ()
        {
            toolbarWnd.remove_show(setTitles);
            //get reference to the tool
            var insertTableTool = sender.getToolByName("InsertTable");
            var insertFormTool = sender.getToolByName("InsertFormElement");
            //set title attribute to modify the tooltip
            insertFormTool.get_element().setAttribute("title", "Form manager");
            insertTableTool.get_element().setAttribute("title", "Table manager");
        }
        toolbarWnd.add_show(setTitles);//add OnClientShow handler which will modify the tooltips
    }
</script>



Sincerely yours,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger Withnell
Top achievements
Rank 1
answered on 23 Jul 2010, 03:00 PM
Great, Dobromir, that works a treat.

On a related question, when I select an item from the InsertForms list, the InsertForms icon changes to the icon of the item that was last selected.

How do I stop this happening so that the InsertForms icon always displays?

Many thanks.

Roger
0
Dobromir
Telerik team
answered on 28 Jul 2010, 11:29 AM
Hi Roger,

You can achieve the required functionality by calling the tool's client-side method set_updateHeader(false), e.g.:
<script type="text/javascript">
    function OnClientLoad(sender, args)
    {
        var toolbarWnd = sender.get_toolAdapter().get_window();//get reference to the window containing the toolbar
        function setTitles ()
        {
            toolbarWnd.remove_show(setTitles);
            //get reference to the tool
            var insertTableTool = sender.getToolByName("InsertTable");
            var insertFormTool = sender.getToolByName("InsertFormElement");
            //set title attribute to modify the tooltip
            insertFormTool.get_element().setAttribute("title", "Form manager");
            insertFormTool.set_updateHeader(false);
            insertTableTool.get_element().setAttribute("title", "Table manager");
        }
        toolbarWnd.add_show(setTitles);//add OnClientShow handler which will modify the tooltips
    }
</script>


Kind regards,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
Roger Withnell
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Roger Withnell
Top achievements
Rank 1
Share this question
or