Skip to main content

Epicor 9 ToolBars

Like any other application, Epicor has list of toolbars and it uses the Infragistics controls and you can modify these toolbars in your code by adding new tools or change the properties for the existing toolbars and Tools.

Epicor uses Infragistics.Win.UltraWinToolbars namespace to manage the toolbars. To manage the toolbars you will use the object “baseToolbarsManager” which created from UltraToolbarsManager class.


Code Examples:

Ø  Using the below code, you will get all toolbars names (by getting the toolbar name you can add a new tool to the toolbar or you can change the properties).
o   First Add the below line to the using section:
          using Infragistics.Win.UltraWinToolbars;
 

o   Add the below codes to Form_Load event:
 try
   {
     string toolbarNames=string.Empty;
     foreach (UltraToolbar toolbar in baseToolbarsManager.Toolbars)
      {
        // add the toolbar name
        toolbarNames+="Toolbar Name:"+toolbar.Key+ "\n";
      }
     MessageBox.Show(toolbarNames);
   }
 catch (Exception Ex)
      {
        ExceptionBox.Show(Ex);
      }

 The result of this code:


Ø  Using the below code, you will get all tools.
o   First Add the below line to the using section:
          using Infragistics.Win.UltraWinToolbars;
 

o   Add the below codes to Form_Load event:
try
   {
     string toolNames=string.Empty;
     foreach (ToolBase tool in baseToolbarsManager.Tools)
      {
        // add the toolbar name
    toolNames+="Tool Name: "+tool.Key+
                  "\t\tTool Type: "+tool.GetType().Name+"\n"; // add the   
    }
    MessageBox.Show(toolNames);
  }
 catch (Exception Ex)
      {
        ExceptionBox.Show(Ex);
      }

The result of this code:


Ø  Using the below code, you will get the tools names under “Standard Tools” toolbar (by getting the tool name you can change properties or use it in baseToolbarsManager.ToolClick event to run any code once the tool is clicked).
o   First Add the below line to the using section:
          using Infragistics.Win.UltraWinToolbars;

o   Add the below codes to Form_Load event:
try
{
    string toolNames=string.Empty;
    foreach (ToolBase tool in baseToolbarsManager.Toolbars["Standard Tools"].Tools)
    {
        toolNames+="Tool Name: "+tool.Key+
                    "\t\tTool Type: "+tool.GetType().Name+"\n"; // add the toolbar name
    }
    MessageBox.Show(toolNames);
}
catch (Exception Ex)
{
    ExceptionBox.Show(Ex);
}


The result of this code:
 
Ø  Using the below code, you will set the “Visible” properties of “DeleteTool” tool to false. By doing this the delete tool will be invisible.
baseToolbarsManager.Tools["DeleteTool"].SharedProps.Visible=false;

The result of this code: The delete tool will be invisible in both Standard Menu and in the file menu.
 
Ø  Using the below code, you will set the “Enabled” properties of “ClearTool” tool to false. By doing this the delete tool will be invisible.
baseToolbarsManager.Tools["ClearTool"].SharedProps.Enabled=false;



Ø  Using the below code. You will add “Print” tool into “Standard Menu” and “File Menu”
o   First Add the below line to the using section:
          using Infragistics.Win.UltraWinToolbars;

o   Add the below codes to Form_Load event:
    ButtonTool prinTool = new ButtonTool("MyPrintTool");
    //Set the properties
    prinTool.SharedProps.Caption = "Print";
    prinTool.SharedProps.Enabled = true;
    prinTool.SharedProps.Visible = true;
    prinTool.SharedProps.AppearancesSmall.Appearance.Image =
          EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Print")];
    //first add the tool to the baseToolbarsManager
    baseToolbarsManager.Tools.Add(prinTool);

    //add the above created tool into Standard Tools toolbar
    baseToolbarsManager.Toolbars["Standard Tools"].Tools.AddTool("MyPrintTool");

  //add the above created tool into file menu in the Main Menu
                ((PopupMenuTool)baseToolbarsManager.Tools["FileMenu"]).
          Tools.AddTool("MyPrintTool");

The result of this code:
 

     The new tool added successfully into “Standard Menu” and “File Menu” but you still need to add a code to be run if the user clicked on this tool. You can implement this in two ways as below:
-       Add ToolClick event for this tool as below:
o   Add the below code to Form_Load event:
             prinTool.ToolClick += new ToolClickEventHandler(prinTool_ToolClick);

o   Add the below event handler in the code editor:
Private staticvoid prinTool_ToolClick(object sender,ToolClickEventArgs args)
     {
         MessageBox.Show("Test Tool");
         //add your code here
     }

-       Use ToolClick event for the baseToolbarsManager:

You can add this event from “Customization Tools design form” => Wizards tab => Form Wizard event tab as below, then add the below code to this event:



Comments

  1. I am trying to disable the Change Log on a Job Entry form available to general users. I tried to adapt the above examples in these two ways, but it didn't work. Would you mind giving some advise?

    baseToolbarsManager.Tools["ChangeLogTool"].SharedProps.Visible=false;

    baseToolbarsManager.Tools["ChangeLogTool"].SharedProps.Enabled=false;

    ReplyDelete
    Replies
    1. Thanks for your comment. The Change Log tool is disabled when you launch the form and it will be enabled once a record is loaded so if you set the visible or enable properties for Change Log tool to false in the form load event, your code will not work.

      You have two solution (I prefer the first solution):

      First. To remove the change log completely from the Job Entry form.Add the below line code into the form load event. This line will remove the change log tool from standard Toolbar and from Actions Menu as well:

      baseToolbarsManager.Tools.Remove(baseToolbarsManager.Tools["ChangeLogTool"]);


      Second. From the Customization Tools Dialog form => Wizards Tab => Form Event Wizard tab

      Select "EpiViewNotification" from the event type drop down list.
      Select "JobHead" from the view drop down list.
      Add this event to your code and then replace the event code with the below:

      if (args.NotifyType == EpiTransaction.NotifyType.Initialize)
      {
      if (args.Row > -1)
      {
      baseToolbarsManager.Tools["ChangeLogTool"].SharedProps.Enabled=false;
      //or baseToolbarsManager.Tools["ChangeLogTool"].SharedProps.Visible=false;
      }
      }

      Delete
  2. Thank you so much! The first option worked wonderfully. By the way, your blog and youtube channel have been great resources for me! Thank you!

    ReplyDelete
  3. Do you know if I can add a print option for a BAQ report to a form based on the method above? Right now, it is a seperate menu item but adding it to the opportunity/quote form would be beneficial.

    ReplyDelete
    Replies

    1. If I understand you correctly, you have a BAQ Report as a separate menu item and you want to call it from the opportunity/quote form.

      You will go to the Menu Maintenance to get the menu ID for your BAQ Report and then you will use the below line code to call it on the method above

      ProcessCaller.LaunchForm(oTrans, "Enter the MenuID for your BAQ Report");

      But if you want to pass a parameter you will do it in tow parts .

      First in the above above print method you will add the below code:

      LaunchFormOptions formOptions = new LaunchFormOptions();
      formOptions.ContextValue = "parameter Value"; // The value to pass to BAQ Report
      ProcessCaller.LaunchForm(oTrans, "Enter the MenuID for your BAQ Report", formOptions); // ** Meun ID for your customized BAQ Report

      Second: In your customized BAQ Report form you will add the below code to FORM LOAD event:

      private static void BAQReportForm_Load(object sender, EventArgs args)
      {
      // Add Event Handler Code
      if (BAQReportForm.LaunchFormOptions != null)
      {
      EpiDataView dv = (EpiDataView)oTrans.EpiDataViews["ReportParam"];
      dv.dataView[dv.Row]["field"] = BAQReportForm.LaunchFormOptions.ContextValue.ToString();
      }
      }

      Delete
    2. I am trying to do this same thing but the Load method is in UD12Form. When I try to replace BAQReportForm with UD12Form it says "LaunchFormOptions" is not a member of 'Epicor.Mfg.UI.App.UD12Entry.UD12Form'). Any suggestions?

      Delete
  4. Worked perfectally, thank you so much for your reply. I really appreciate your blog, please keep adding content!

    ReplyDelete
  5. Hi, Do you know if I can add a custom button in the form and when to click it, works like the refresh button?

    ReplyDelete
    Replies
    1. You can add a custom button to Epicor form and then write the below line of code in the button click method to mimic the refresh button.

      oTrans.Refresh();

      Good luck.

      Delete
  6. Hello Sir,

    Sir I want to launch Job Receipt to Inventory form from END Activity with Job Number as parameter.
    Job number should be taken from END Activity.

    ReplyDelete
  7. Hellpo there, I discovered your web site byy way of Google whilst searching ffor a comparable subject, your site came up, itt appears great.
    I have bookmarked it in my google bookmarks.
    Hi there, simply wass aware of your weblog via Google, and
    found that it's ttruly informative. I'm going to be careful for
    brussels. I will be grateful should you proceed
    this in future. Numerous people will be benefited outt of your writing.
    Cheers!

    my webpage - directory

    ReplyDelete
  8. Waleed,

    Great post, this was very useful. Do you know how to get a list of the image names available?

    ReplyDelete
    Replies
    1. Thanks.

      Actually you can get all images names using ICE Resource Editor tool. this tool will give you the ability to see the names of images and modify them if you need.

      Please refer to blog article:

      http://epicor-development.blogspot.com/2014/04/epicor-resource-editor.html

      Delete
    2. Thank you this article very useful for me.

      Delete
  9. Thanks Waleed. I reached this post through Google search.
    This is an amazing & very helpful post.

    ReplyDelete
  10. Do you know how I can hide the "Create New Ship To" option in Customer? You can get to it from 2 places:
    1. File -> New dropdown -> New Ship to
    2. New dropdown -> New Ship to

    I don't want the users to create any additional ship-to...

    ReplyDelete
  11. I want to activate the Clear button by Customization of C#
    Do your know what is the method name or how to do it from the code?

    ReplyDelete
  12. I want to activate the Clear button by Customization of C#
    Do your know what is the method name or how to do it from the code?

    ReplyDelete
  13. I'm attempting to prevent users from Personalizing a particular application. I'm able to disable or make invisible the Personalization option under the Tools Menu using the Before_ToolDropDown in the Form Event. The problem is that the Personalization option also shows up under a menu when Right clicking. Is it possible to disable those option within the UI tool?

    ReplyDelete
    Replies
    1. Un-Check the "Allow Personalization" check box
      for that user in the User Maintenance -> Options
      window

      Delete
  14. Great post,.....in Form Entry Wizard, what code do i use to default ScheduleEngine.Finite to true?....(this is when you create a new job and then proceed to schedule it).
    Thanks in advance.

    ReplyDelete
  15. Hi, first of all congratulations for your blog! Do you how can I get the guid of a standard tool? I'm trying to open the Memo Entry form by clikcing on button.

    Thanks

    ReplyDelete
  16. I don't have any guide for Standard tool. To open Memo Entry form by clicking button you can use "LaunchFormOptions" as below:

    LaunchFormOptions launchObject = new LaunchFormOptions();
    launchObject.SupressFormSearch = true;
    launchObject.ValueIn = "Value"; //valuein of Memo Entry ou want to pass
    ProcessCaller.LauncForm(oTrans,"IM))", launchObject); //parameters are as follows: sender, string value of menu id you want to launch, launchformoptions

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Use the Business Activity Query Export Process

Business Activity Query Export Process let you export the BAQ data in XML or CSV format. You can export the BAQ data manually and you can schedule it to run automatically (Daily, Weekly, ,Monthly,Once,startup..etc) and you can configure this in the “system agent maintenance” and I will explain this later in this article.