I have added a button into a customized menu (issue material) of E10 and am trying to launch another menu from this screen. The end goal is to have the new menu load the information for the active work order being utilized in the issue material screen, but at the moment I am having issues just getting another menu to pop up. I am currently trying to use the event wizard with the code below, which compiles ok but doesn’t actually do anything upon the click of the button specified. Am I utilizing the event wizard incorrectly?
That’s the odd part is there is no error at all, so I added a couple of lines for text display (one after and one before the process caller) to see if the code was actually being kicked off or not and those lines don’t show up either. Just no activity happening upon the button click.
Sure thing, and no the button is still just epiButtonC1.
// **************************************************
// Custom code for IssueMaterialForm
// Created: 12/15/2021 8:33:51 AM
// **************************************************
extern alias Erp_Contracts_BO_IssueReturn;
extern alias Erp_Contracts_BO_JobEntry;
extern alias Erp_Contracts_BO_JobAsmSearch;
extern alias Erp_Contracts_BO_JobMtlSearch;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
MessageBox.Show("is the command breaking before the launchform?");
ProcessCaller.LaunchForm(oTrans, "OMMT1112");
MessageBox.Show("The command is working");
}
Your Click event was never registered with the system. There should be an event registration (and removal) in InitializeCustomCode() and DestroyCustomCode();
public void InitializeCustomCode()
{
// Stuff here
this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
// More Stuff here
}
public void DestroyCustomCode()
{
// Stuff here
this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
// More Stuff here
}
I see what you’re saying, I’ve never used the event wizard before so I’m not quite sure how to address that. Should I just edit the script and insert the missing lines? Or does this just mean I’ve setup the event incorrectly and need to redo it?
Hey @josecgomez , I have an issue. When I tried to add an event handler for the onclick event for a button I added for testing, I got an error after closing the editor and trying to open it again. Could you give me a hint on how to fix it back
I fixed it by copying the code back through maintenance. May I ask, how do we create a new one from scratch? Maybe I can use it for testing instead of having to modify the one that is currently in use. For example, how can I add a new one below these?