Using a .config file with a custom button

Last post 10-03-2006, 3:30 PM by possiblybob. 7 replies.
Sort Posts: Previous Next
  •  03-31-2005, 10:36 PM 5216

    Using a .config file with a custom button

    In CuteEditor 2.0, I was able to create a custom toolbar that used a custom button.

    I have since then upgraded to CuteEditor 4.0.  I was going over the Developer's Guide on how to create a custom toolbar configuration file and how to add my own custom button.  However, there does not seem to be any documentation on how to create a custom toolbar configuration file that uses a custom button.  Is it even possible to do this?
    I created a custom toolbar configuration file which has the following line of code:
     
        <itemtype="image"name="InsertTournamentBracket"imagename="insTourneyBracket"/>
     
    Where do I insert my code to handle when this button is clicked?  I went through the CuteEditor code and can't find where buttons like "Insert Horizontal Line" are managed.
  •  04-01-2005, 10:36 AM 5229 in reply to 5216

    Re: Using a .config file with a custom button

    This is an example:

            Dim ctrl As System.Web.UI.WebControls.WebControl
            ctrl = Editor1.CreateCommandButton("MyButton", "text.gif", "Insert My Custom Text")
            ctrl.Attributes("onclick") = "ShowMyDialog(this)"
            'add this custom button into the editor
            Editor1.InsertToolControl(pos, "MyButton", ctrl)
     
     
    You can find the source code of the above example in the download package.
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-01-2005, 1:33 PM 5241 in reply to 5229

    Re: Using a .config file with a custom button

    Are there other alternatives?

    The reason that I ask is because the custom buttons that I want to create will be used across multiple applications.  Rather than having a programmer insert this on every page that uses a custom button, I would like it available to the graphic designers via the .config file.
     
    Is there a way to create a custom button where the existing CuteEditor buttons -- such as "Insert Horizontal Line" -- reside?  I In CuteEditor 2.0, we were able to achieve this by adding code in the file CuteEditor.cs.
  •  10-01-2006, 4:17 AM 23249 in reply to 5241

    Re: Using a .config file with a custom button

    I want to add a button to insert code.I have seen the demo http://cutesoft.net/example/howto/AddButtons/vb/create_a_custom_button.aspx and the example file in cuteEdtor 5,
    but I don't know what's the mean in CuteEditor Developer Guide:
    Now you can use the custom button in the template list:
     
    <CE:EDITOR id="Editor1" runat="server" TemplateItemList="[Bold,Italic]/[mybutton]">

    Is that said :I want to add this tag in template.aspx file of the cuteeditor directory,but I ensure that not mean this,and can't you help me how to add a insertcode button,here is my c# code:
                 int pos = Editor1.ToolControls.IndexOf("InsertImage") + 1;
                WebControl ctrl = Editor1.CreateCommandButton("Insertcode", "text.gif", "Insert Code");
                ctrl.Attributes["onclick"] = "ShowMyDialog(~/InsertCode.aspx)";
                Editor1.InsertToolControl(pos, "Insertcode", ctrl);
    and next what I want to do?
    Thanks~
  •  10-01-2006, 7:40 PM 23255 in reply to 23249

    Re: Using a .config file with a custom button

    tother,
     
    You code should work.
     
    The source code of this example (http://cutesoft.net/example/howto/AddButtons/vb/create_a_custom_button.aspx) is as followings:
     
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@ Page language="c#"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <script language="JavaScript" type="text/javascript" >
     function ShowMyDialog(button)
     {
      //use CuteEditor_GetEditor(elementinsidetheEditor) to get the cute editor instance
      var editor=CuteEditor_GetEditor(button);
      //show the dialog page , and pass the editor as newwin.dialogArguments
      var newwin=showModalDialog("My_Custom_Text.html?_rand="+new Date().getTime()
        ,editor,"dialogWidth:400px;dialogHeight:240px");
     }
    </script>
    <html>
        <head>
      <title>title>
      <link rel="stylesheet" href="../../example.css" type="text/css" />
     </head>
        <body >
            <form runat="server" ID="Form1"> 
       <h2>How to create a custom button which displays a dialog?</h2> <hr>
       
       <CE:Editor id="Editor1" runat="server" AutoConfigure="Minimal"></CE:Editor><br />   
      
      </form>
     </body>
    </html>
    <script runat="server">
     private void Page_Load(object sender, System.EventArgs e)
     {
      //about Italic, see Full.config
      //<item type="image" name="Italic" imagename="Italic" />
      //get the pos after the Italic
      int pos=Editor1.ToolControls.IndexOf("Italic")+1;
      //Themes/%ThemeName%/Images/text.gif
      WebControl ctrl=Editor1.CreateCommandButton("MyButton","text.gif","Insert My Custom Text");
      ctrl.Attributes["onclick"]="ShowMyDialog(this)";
     
      //add this custom button into the editor
      Editor1.InsertToolControl(pos,"MyButton",ctrl);
     }
    </script>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-02-2006, 2:31 AM 23266 in reply to 23255

    Re: Using a .config file with a custom button

    Sorry,May I ask a question which make a laughingstock of oneself before experts.
    This is only a aspx file,Can you tell me, I have no need to add CS code to bulid my solution?,and what the aspx code file should be placed,is it placed in to the CuteSoft_Client\CuteEditor\Dialogs folder,and how to register the custom button into toolbar,how to make it display in the toolbar??Thank you for help.Thank you.
  •  10-02-2006, 3:06 AM 23269 in reply to 23255

    Re: Using a .config file with a custom button

    And what't the AutoConfigure="Minimal" Mean,is it used to register this custom button into the Minimal.config,and can be shown if the minimal.config called by users?
    I have config a custom config file named Administrators.config,I want to auto configure  to my Administrators.config,but how to do that,I put the path text to instead of AutoConfigure="Minimal" ,but it cause a error"Error 105 Validation (ASP.Net): The values permitted for this attribute do not include '~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/Administrators.config'. Please help,
    Thanks.
  •  10-03-2006, 3:30 PM 23322 in reply to 23269

    Re: Using a .config file with a custom button

    An alternate method to going into the CuteSoft files to add the new button would be to create a user control that wraps the CuteSoft component.  Just enter the code that loads the custom button (the code written by Adam and highlighted in yellow above) in the control's Page_Load method.  Also include the accompanying JavaScript functions in this control. 

    Whenever I want to use the configuration of the CuteEditor that uses the custom button, I just drop the user control onto the page, and it loads the custom button for me without any additional code.  It might be a possible work around for your situation.
View as RSS news feed in XML