I have this code for my end activity screen in the MES. I have posted about it before but now that I am trying to finalize everything and getting it ready to show our shop floor workers it refuses to work the way it should.
I have kind of given up on the bit about selecting the qty field working every time but one part that doesn’t work is crucial for our barcoding.
Basically the barcode tabs to my custom mark complete button and presses enter. after it is pressed it flips the complete checkbox to true and SHOULD select the ok button so the barcode can hit enter again and close the screen. Unfortunately the button only selects the ok button sometimes. most of the time epicor just decides to skip over those 2 lines of code and I can’t tell why. Anyone know why this would happen? It’s extremely frustrating because I know that it should work.
// **************************************************
// Custom code for EndActForm
// Created: 3/28/2017 2:15:03 PM
// **************************************************
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 **
EpiCheckBox complete = new EpiCheckBox();
EpiNumericEditor qty = new EpiNumericEditor();
EpiButton ok = new EpiButton();
Timer t = new Timer();
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
this.markComplete.Click += new System.EventHandler(this.markComplete_Click);
// End Wizard Added Custom Method Calls
t.Interval = 1000;
t.Tick += new EventHandler(SelectBox);
t.Start();
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.markComplete.Click -= new System.EventHandler(this.markComplete_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
t.Tick -= new EventHandler(SelectBox);
}
private void markComplete_Click(object sender, System.EventArgs args)
{
complete = (EpiCheckBox)csm.GetNativeControlReference("6456654a-e39c-486b-bfdb-7a4cc16fe4ec");
complete.Checked = true;
ok = (EpiButton)csm.GetNativeControlReference("025fc115-fee3-4973-946e-ba209189d62e");
ok.Select();
}
public void SelectBox(object sender, EventArgs e)
{
t.Stop();
qty = (EpiNumericEditor)csm.GetNativeControlReference("f1fdcf24-066d-424e-9b59-319a804854fa");
qty.Select();
}
private void EndActForm_Load(object sender, EventArgs args)
{
}
}