FreeTextBox3.0 Toolbar configuration

Toolbar Configuration
<script language=jscript type=text/jscript> function LinkMenu(anArray) { var src = ""; var h = 0; var w = 0; window.event.cancelBubble = 'true'; var menu = document.getElementById("LinkMenu"); if (menu == null) { menu = document.createElement("div"); menu.id = 'LinkMenu'; menu.className = 'Menu'; document.body.appendChild(menu); } menu.innerHTML = ""; for (var i = 0; i < anArray.length; i++) { var pair = anArray[i]; var each = ""; var itemName = 'LinkMenu' + i; each += ' '; menu.innerHTML += each; var item = document.getElementById(itemName); if (item.offsetWidth > w) w = item.offsetWidth; h += item.offsetHeight; } menu.innerHTML = '
' + menu.innerHTML + '
'; menu.style.left = window.event.clientX; menu.style.top = window.event.clientY; menu.style.height = h; menu.style.width = w; timeout = null; menu.style.display = 'block'; } var timeout = null; var tipOffTimeout = null; function TopicTipOn(anchor, id) { var targetY = document.body.scrollTop + window.event.clientY + 18; var targetX = document.body.scrollLeft + window.event.clientX + 12; TopicTip.style.left = targetX; TopicTip.style.top = targetY; var tip = document.getElementById(id); TopicTip.innerHTML = tip.innerHTML; TopicTip.style.display = 'block'; if (tipOffTimeout != null) window.clearTimeout(tipOffTimeout); tipOffTimeout = window.setTimeout("TopicTipOff()", 4000, "JScript"); } function TopicTipOff() { if (tipOffTimeout != null) window.clearTimeout(tipOffTimeout); tipOffTimeout = null; TopicTip.style.display = 'none'; } function MenuClick(url) { MenuHide(); window.navigate(url); } function MenuIn(obj) { if (timeout == null) return; window.clearTimeout(timeout); timeout = null; } function MenuOut(obj) { timeout = window.setTimeout("MenuTimeout()", 1000, "JScript"); } function MenuTimeout() { MenuHide(); } function MenuHide() { var menu = document.getElementById("LinkMenu"); menu.style.display = 'none'; } function MenuItemIn(obj) { obj.className = 'MenuItemHover'; } function MenuItemOut(obj) { obj.className = 'MenuItemNormal'; } </script> .
Summary How to configure various ToolbarButtons and ToolbarDropDownLists in FreeTextBox

Toolbar configuration

There are three ways to configure the FreeTextBox toolbar area

1. ToolbarLayout String

This property accepts a string of ToolbarItem names. Use commas ( , ) to separate items. A pipe ( | ) will insert a ToolbarSeparator and a semicolon ( ; ) will start a new Toolbar.

The default way to configure toolbars is to use use the propery ToolbarLayout

 <html>
 <body>
   <form runat="server">
     <FTB:FreeTextBox id="FreeTextBox1"
       ToolbarLayout="paragraphmenu,fontsizesmenu;bold,italic,underline|
        bulletedlist,numberedlist"
       runat="Server" />
   </form>
 </body>
 </html>

Valid values for ToolbarButtons and ToolbarDropDownLists are

 ParagraphMenu, FontFacesMenu, FontSizesMenu, FontForeColorsMenu, 
 FontForeColorPicker, FontBackColorsMenu, FontBackColorPicker, Bold, Italic, Underline,
 Strikethrough, Superscript, Subscript, InsertImageFromGallery, CreateLink, Unlink, 
 RemoveFormat, JustifyLeft, JustifyRight, JustifyCenter, JustifyFull, BulletedList, 
 NumberedList, Indent, Outdent, Cut, Copy, Paste, Delete, Undo, Redo, Print, Save, 
 ieSpellCheck, StyleMenu, SymbolsMenu, InsertHtmlMenu, InsertRule, InsertDate, 
 InsertTime, WordClean, InsertImage, InsertTable, EditTable, InsertTableRowBefore, 
 InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter, 
 DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea, 
 InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv, 
 InsertImageFromGallery, Preview, SelectAll, EditStyle

The following values are only available in Pro versions of FreeTextBox (or if running on localhost)

 FontForeColorPicker, FontBackColorPicker, EditTable
 InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter, 
 DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea, 
 InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv, 
 Preview, SelectAll, EditStyle, WordClean

2. Procedurally

You can define which toolbar items appear by adding ToolbarItems in much the same way that one would add DataGrid Columns to a DataGrid. In order to do this, set AutoGenerateToolbarLayoutFromString=false:

 <html>
 <body>
    <form runat="server">
        <FTB:FreeTextBox id="FreeTextBox1" AutoGenerateToolbarsFromString="false" runat="server" >
            <Toolbars>
                <FTB:Toolbar runat="server">
                    <FTB:ParagraphMenu runat="server" />
                    <FTB:FontSizesMenu runat="server" />
                </FTB:Toolbar>
                <FTB:Toolbar runat="server">
                    <FTB:Bold runat="server" />
                    <FTB:Italic runat="server" />
                    <FTB:Underline runat="server" />
                    <FTB:ToolbarSeparator runat="server" />
                    <FTB:BulletedList runat="server" />
                    <FTB:NumberedList runat="server" />
                </FTB:Toolbar>
                <FTB:Toolbar runat="server">
                    <FTB:InsertHtmlMenu runat="server">
                        <Items>
                            <FTB:ToolbarListItem Text="Cool1" Value="<b>lalala</b>" runat="server" />
                            <FTB:ToolbarListItem Text="Cool2" Value="<i>lalala</i>" runat="server" />
                            <FTB:ToolbarListItem Text="Cool3" Value="<u>lalala</u>" runat="server" />
                        </Items>
                    </FTB:InsertHtmlMenu>
                    <FTB:StyleMenu runat="server">
                        <Items>
                            <FTB:ToolbarListItem Text="Highlighed" Value="<b>Highlighed</b>" runat="server" />
                            <FTB:ToolbarListItem Text="SmallCaps" Value="<i>smallcaps</i>" runat="server" />
                        </Items>
                    </FTB:StyleMenu>
                </FTB:Toolbar>
            </Toolbars>
        </FTB:FreeTextBox>
    </form>
 </body>
 </html>

3. Code (Page_Load or Code Behind)

ToolbarButtons and ToolbarDropDownLists can also be set through code. You should set the property AutoGenerateToolbarsFromString to false if you want only the ToolbarItems you define.

 <script runat="server">
 void Page_Load(object Src, EventArgs E) {
    Toolbar toolbar1 = new Toolbar();
    toolbar1.Items.Add(new ParagraphMenu());
    toolbar1.Items.Add(new FontSizesMenu());


    FreeTextBox1.Toolbars.Add(toolbar1);


    Toolbar toolbar2 = new Toolbar();
    toolbar2.Items.Add(new Bold());
    toolbar2.Items.Add(new Italic());
    toolbar2.Items.Add(new Underline());
    toolbar2.Items.Add(new ToolbarSeparator());
    toolbar2.Items.Add(new BulletedList());
    toolbar2.Items.Add(new NumberedList());


    FreeTextBox1.Toolbars.Add(toolbar2);


    Toolbar toolbar3 = new Toolbar();
    StyleMenu styleMenu = new StyleMenu();
    styleMenu.Items.Add(new ToolbarListItem("Highlight","Highlight"));
    styleMenu.Items.Add(new ToolbarListItem("SmallCaps","smallcaps"));


    toolbar3.Items.Add(styleMenu);


    FreeTextBox1.Toolbars.Add(toolbar3);
 }
 </script>
 <html>
 <body>
    <form runat="server">
        <FTB:FreeTextBox id="FreeTextBox1" AutoGenerateToolbarsFromString="false" runat="server" />
    </form>
 </body>
 </html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值