I have a working form customization to disable the (empty sheet) icon menu used to create a new transaction based on the selecedt tab. For example: In Supplier Maintenance entry screen, you when the main tab is select and you click on the (empty sheet) icon menu, Epicor will create a new Supplier record in the form. If the Contacts tab is selected, the a new contact record will be inserted accordingly.
For my need, I just have to determine which active tab the user is in before disabling the target menu icon. The rest of my code works works well. I just need to know how to determine the current active panel.
//To disable the menus when certain sheets are on focus
Epicor.Mfg.UI.FrameWork.EpiBasePanel mnpnl; // Declaring a variable as EpiBasePanel
mnpnl =(Epicor.Mfg.UI.FrameWork.EpiBasePanel)csm.GetNative ControlReference(â1dff11bc-3024-4d17-acfc-b7af287e274bâ);//Main panel (Parent Panel) copy the GUID of the parent panel
if (mnpnl!=null)
{
string strActiveControlName=mnpnl.ActiveControl.ToString( );//This gives active sheet name
}
However, this is the code that works for 10.1.400.16:
EpiDockManagerPanel mnpnl = (EpiDockManagerPanel)csm.GetNativeControlReference("cb0296df-4188-4ab3-ba3f-65e287db6ace");
if (mnpnl!=null)
{
string strActiveControlName = mnpnl.ActiveControl.ToString();
//This gives active sheet name
MessageBox.Show(strActiveControlName);
}
oTrans.LastView lets you compare against an EpiDataView object
if (oTrans.LastView == _edvUD06) {
// TODO
}
oTrans.LastView.ViewName lets you compare the ViewName.
if (oTrans.LastView.ViewName == "OrderHed") {
// TODO
}
It doesnât matter if they are on letâs say the Detail Tab or the List tab â it doesnât matter if the user is using a language pack for Chinese or English⌠it will work.
Example on UD100
private void UD100Form_AfterToolClick(object sender, Ice.Lib.Framework.AfterToolClickEventArgs args)
{
switch (args.Tool.Key)
{
case "NewMenuTool":
case "DeleteTool":
case "EpiAddNewnewParent":
// If Parent is being Reset or Deleted
if (this.oTrans.LastView == edvUD100 && edvUD100.Row == -1) {
this.ClearUI();
}
break;
}
}
Example on Quote with a Child UD06
case "DeleteTool":
if ((oTrans.LastView).ViewName == "UD06View")
{
DialogResult dialogResult = EpiMessageBox.Show("Are you sure you would like to delete this Tooling Cost?", "Tooling Cost", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes) {
DeleteUD06Record();
}
args.Handled = true;
}
break;
If you really must need to find the Sheet you can use this member which exists on every Form CustomerTrackerForm.SelectedSheetGuid so you donât hard-code the guid.
The first options should get me out of trouble, I tried the last option but got the following error
Error: CS0122 - line 603 (1219) - âIce.Lib.Framework.EpiBaseForm.SelectedSheetGuidâ is inaccessible due to its protection level
Error: CS0271 - line 603 (1219) - The property or indexer âIce.Lib.Framework.EpiBaseForm.SelectedSheetGuidâ cannot be used in this context because the get accessor is inaccessible