ActiveReports 6 Online Help
Customize the FlashViewer Toolbar (Pro Edition)
See Also Send comments on this topic.
ActiveReports 6 > ActiveReports User Guide > How To > Customize, Localize and Deploy > Customize the FlashViewer Toolbar (Pro Edition)

Glossary Item Box

When you select the FlashViewer ViewerType of the WebViewer (Professional Edition license), the FlashViewer toolbar is very similar to the Viewer control's toolbar. You can show or hide it, reorder buttons, remove buttons, add custom buttons, or create a custom toolbar. Use the Web.Controls namespace to create custom buttons or a custom toolbar that you can specify in the WebViewer's FlashViewerToolbar property.

Hide the Toolbar

Reorder Buttons

Remove a Button

Create a Custom Button

Create a Custom Toolbar

The buttons that are available in the toolbar by default are:

  • TOCButton
  • PrintButton
  • PageRangeButton
  • SearchButton
  • ZoomOutButton
  • ZoomBox
  • ZoomInButton
  • SinglePageViewButton
  • MultiPageBox
  • ContinuousViewButton
  • PreviousPageButton
  • NextPageButton
  • CurPageTextArea
  • BackwardButton
  • ForwardButton

    To hide the toolbar

    Note: If the ViewerType property of your WebViewer control is not set to FlashViewer, this code is ignored.
    1. In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
    2. In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
    3. Use code like the following to hide the toolbar:

      ShowTo write the code in Visual Basic.NET

      Visual Basic.NET code. Paste INSIDE the Page Load event. Copy Code
      WebViewer.FlashViewerToolBar.Visible = False

      ShowTo write the code in C#

      C# code. Paste INSIDE the Page Load event. Copy Code
      WebViewer1.FlashViewerToolBar.Visible = false;

    To rearrange buttons in the toolbar

    1. In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
    2. In the design view of your web form, double-click the page. This creates an event handling method for the Page Load event and takes you to the code view of the page.
    3. Use code like the following to create a button and insert it at the beginning of the toolbar:

      ShowTo write the code in Visual Basic.NET

      Visual Basic.NET code. Paste INSIDE the Page Load event. Copy Code
      'Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.)
      Dim tool As DataDynamics.ActiveReports.Web.Controls.ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton")
      'Remove the tool from the toolbar.
      WebViewer1.FlashViewerToolBar.Tools.Remove(tool)
      'Add the tool in a different position.
      WebViewer1.FlashViewerToolBar.Tools.Insert(0, tool)
      

      ShowTo write the code in C#

      C# code. Paste INSIDE the Page Load event. Copy Code
      //Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.)
      ToolBase tool =  WebViewer1.FlashViewerToolBar.Tools[ToolsCollection.ToolCommands.PageRangeButton];
      //Remove the tool from the toolbar.
      WebViewer1.FlashViewerToolBar.Tools.Remove(tool);
      //Add the tool in a different position.
      WebViewer1.FlashViewerToolBar.Tools.Insert(8, tool);
      

    To remove a button from the toolbar

    1. In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
    2. In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
    3. Use code like the following to remove a button from the toolbar:

      ShowTo write the code in Visual Basic.NET

      Visual Basic.NET code. Paste INSIDE the Page Load event. Copy Code
      'Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.)
      Dim tool As DataDynamics.ActiveReports.Web.Controls.ToolBase = WebViewer1.FlashViewerToolBar.Tools("PageRangeButton")
      'Remove the tool from the toolbar.
      WebViewer1.FlashViewerToolBar.Tools.Remove(tool)
      

      ShowTo write the code in C#

      C# code. Paste INSIDE the Page Load event. Copy Code
      //Get an existing tool from the toolbar. (If you prefer, you can specify the index of the tool.)
      ToolBase tool =  WebViewer1.FlashViewerToolBar.Tools[ToolsCollection.ToolCommands.PageRangeButton];
      //Remove the tool from the toolbar.
      WebViewer1.FlashViewerToolBar.Tools.Remove(tool);
      

    To create a custom button and add it to the toolbar

    Tip: The ToolsCollection class in the Web.Controls namespace has the standard System.Collections.ObjectModel.Collection methods available, so if you want to just add the button to the end of the toolbar, you can use the Add method instead.
    1. In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
    2. In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
    3. Use code like the following to create a button and insert it at the beginning of the toolbar:

      ShowTo write the code in Visual Basic.NET

      Visual Basic.NET code. Paste INSIDE the Page Load event. Copy Code
      Dim customButton As ToolButton = Tool.CreateButton("CustomButton")
      customButton.Caption = "Visit Us!"
      customButton.ToolTip = "Click here to visit datadynamics.com"
      customButton.ClickNavigateTo = "http://www.datadynamics.com"
      'Insert the button at the specified index, in this case 20 
      'to put it in the second-to-last place, between Backward and Forward. 
      'Set the index parameter to 0 to put it in the left-most position.
      WebViewer.FlashViewerToolBar.Tools.Insert(20, customButton)
      

      ShowTo write the code in C#

      C# code. Paste INSIDE the Page Load event. Copy Code
      ToolButton customButton = Tool.CreateButton("CustomButton");
      customButton.Caption = "Visit Us!";
      customButton.ToolTip = "Click here to visit datadynamics.com";
      customButton.ClickNavigateTo = "http://www.datadynamics.com";
      //Insert the button at the specified index, in this case, 20 
      //to put it in the second-to-last place, between Backward and Forward. 
      //Set the index parameter to 0 to put it in the left-most position.
      WebViewer.FlashViewerToolBar.Tools.Insert(20, customButton);
      

    To create a custom toolbar and add it to the viewer

    1. In the Visual Studio Solution Explorer, right-click the ASPX file that contains your WebViewer and select View Designer.
    2. In the design view of your web form, double-click the WebViewer. This creates an event handling method for the Page Load event and takes you to the code view of the page.
    3. Use code like the following to create a custom toolbar and add it to the viewer:

      ShowTo write the code in Visual Basic.NET

      Visual Basic.NET code. Paste INSIDE the Page Load event. Copy Code
      'Get the collection of buttons and separators used in the toolbar
      Dim collection As DataDynamics.ActiveReports.Web.Controls.ToolsCollection = WebViewer1.FlashViewerToolBar.Tools
      'Remove all buttons and separators
      collection.Clear()
      'Add pre-defined buttons
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomOutButton))
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomBox))
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomInButton))
      'Add separator
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator())
      'Add pre-defined button
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.SearchButton))
      'Add separator
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator())
      'Add custom buttons
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn1"))
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn2"))
      

      ShowTo write the code in C#

      C# code. Paste INSIDE the Page Load event. Copy Code
      //Get the collection of buttons and separators used in the toolbar 
      DataDynamics.ActiveReports.Web.Controls.ToolsCollection collection = WebViewer1.FlashViewerToolBar.Tools; 
      //Remove all buttons and separators 
      collection.Clear(); 
      //Add pre-defined buttons 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomOutButton)); 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomBox)); 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.ZoomInButton)); 
      //Add separator 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()); 
      //Add pre-defined button 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.Create(DataDynamics.ActiveReports.Web.Controls.ToolsCollection.ToolCommands.SearchButton)); 
      //Add separator 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateSeparator()); 
      //Add custom buttons 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn1")); 
      collection.Add(DataDynamics.ActiveReports.Web.Controls.Tool.CreateButton("btn2")); 
      

    In the Class Library portion of the documentation, you can see all of the available properties and methods in the Web assembly's Controls namespace.

  • See Also