Custom button

Last post 12-10-2013, 10:10 AM by frJericho. 4 replies.
Sort Posts: Previous Next
  •  12-05-2013, 6:42 PM 78517

    Custom button

     The following sample shows an example of adding a custom button in C# code and configuring the image, tooltip, etc. in JavaScript

    http://richtexteditor.com/demo/custom_buttons.aspx

     

    Is there a way to do it all in C#? 

  •  12-06-2013, 8:10 AM 78527 in reply to 78517

    Re: Custom button

    Hi frJericho,

     

    For now has not the way to add custom button all by the server side code. We will add this in the future version. Sorry for your inconvenience.

     

    Regards,

     

    Ken 

  •  12-06-2013, 9:42 AM 78529 in reply to 78527

    Re: Custom button

    Is the JavaScript code to configure buttons documented? I can't seem to find any documentation.

    For example, I notice in a few example that we can set the icon on a button with:

    this.set_imagename("openfolder");
    

    I am guessing this works because RTE knows what the "openfolder" icon is but what if I want a custom icon? Is it possible to do something like:

    this.set_image("http://mysite.com/images/myimage.jpg");
    
     
  •  12-10-2013, 4:12 AM 78552 in reply to 78529

    Re: Custom button

    Dear frJericho,

     

    The toolbar image path solution in  RTE likes the below code

     

    1.  this.set_imagename("openfolder");

    2. RTE will find "richtexteditor/images/openfolder.png” as the image source in this demo.

     

    Regards,

    Jeff 

  •  12-10-2013, 10:10 AM 78567 in reply to 78552

    Re: Custom button

     Jeff,

     

    I don't think you took the time to read to example I gave you. I am trying to use a custom image on my button. The image is not located in the RTE path. The image in my example was http://mysite.com/image/myimage.jpg

     

    Please note that this was very easily done in CE 6 with C# code similar to this:

     

     
    1. private static void ConfigureCustomEditorButton(CE.ToolControl button, string tooltip, string imageUrl, string cssClass, string onClick)  
    2. {  
    3.     if (button == nullreturn;  
    4.   
    5.     using (var image = new Image())  
    6.     {  
    7.         image.ToolTip = tooltip;  
    8.         image.ImageUrl = imageUrl;  
    9.         image.CssClass = cssClass;  
    10.         image.Attributes["onmouseover"] = "CuteEditor_ButtonCommandOver(this)";  
    11.         image.Attributes["onmouseout"] = "CuteEditor_ButtonCommandOut(this)";  
    12.         image.Attributes["onmousedown"] = "CuteEditor_ButtonCommandDown(this)";  
    13.         image.Attributes["onmouseup"] = "CuteEditor_ButtonCommandUp(this)";  
    14.         image.Attributes["ondragstart"] = "CuteEditor_CancelEvent()";  
    15.         image.Attributes["onclick"] = onClick;  
    16.         button.Control.Controls.Add(image);  
    17.     }  
    18. }  
     
View as RSS news feed in XML