Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mort Reddov on May 01, 2009 02:51
open dhtmlx forum
dhtmlxeditor and dhtmlxtoolbar: how to add a custom button to editor's toolbar

I would like to add custom buttons / functions to the toolbar inside a dhtmlxeditor.

Is that possible?

If yes, how would I address the toolbar object inside the editor object..?

Cheers,
Mort
Answer posted by Alex (support) on May 04, 2009 02:03

Hello, 

the toolbar object can be got by tb property:

editor.tb.addButton("new", 0, "New button");

Answer posted by Mort Reddov on May 07, 2009 04:35
Thanks for your reply.

I still have trouble getting this to work.
Could you please provide a working example of how to get this working?
My code so far (Firebug message: "editor.tb is undefined"):

            function doInitEditor() {
                editor = new dhtmlXEditor("editor_container", "standard");
                editor.setIconsPath(image_path);
               
                var tb = new dhtmlXToolbarObject("toolbar_container");
                tb.setIconsPath(image_path);

                editor.tb.addButton("test", 0, "Test Button 1");

                editor.init();
            }

Thanks, Mort.
Answer posted by Alex (support) on May 07, 2009 04:49

You can try to use the following approach:

 function doInitEditor() {
  editor = new dhtmlXEditor("editor_container", "standard");
  editor.setIconsPath(image_path);
  editor.init();
  editor.tb.addButton("test", 0, "Test Button 1");

  }

Answer posted by Mort Reddov on May 07, 2009 07:36
Oh man, I should have thought of that...

Thanks anyways, it works now fine!

Mort.