Adding new folder in Item Master Data
Emanuele Croci
Dear all,I added a new folder in the Item Master Data form.
I would like to insert a new textbox in this tab where I write a specific value associated to the item.
But when I move from an item to the next (or previous) using the arrows, customize function updates the textbox value but the item master data form go into UPDATE mode.
Here, my source code on DataLoad event:
try
{
pVal.Form.Freeze(true);
SwissAddonFramework.UI.Components.TextEdit myCodeText = null;
SwissAddonFramework.UI.Components.TextEdit myPromoText = null;
try
{
//Se la form viene richiamata da un'altra form, allora la seguente istruzione genera errore
//dovendo ricreare tutti i componennti della TAB. Ecco il motivo del catch.
myCodeText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtCode");
myPromoText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtProm");
}
catch(System.Exception e1)
{
SwissAddonFramework.UI.Components.Folder FOLDER1 = SwissAddonFramework.UI.Components.Folder.CreateNew("CostFold");
FOLDER1.Top = 10;FOLDER1.Width = 400;FOLDER1.Left = 200;FOLDER1.Height = 14;
FOLDER1.Pane = 78;
FOLDER1.AffectsFormMode = false;
FOLDER1.Value = "Costi";
FOLDER1.Description = "Costi";
pVal.Form.AddItem(FOLDER1);
//Aggiunta etichetta
SwissAddonFramework.UI.Components.Label myLabel = SwissAddonFramework.UI.Components.Label.CreateNew("lblCode");
myLabel.SetSizeAndPosition(Label.GetFromUID(pVal.Form, "56"));
myLabel.Left = myLabel.Left + 10;
myLabel.FromPane = 78;
myLabel.ToPane = 78;
myLabel.Value = "Chiave in tabella";
pVal.Form.AddItem(myLabel);
myLabel = SwissAddonFramework.UI.Components.Label.CreateNew("lblProm");
myLabel.SetSizeAndPosition(Label.GetFromUID(pVal.Form, "56"));
myLabel.Left = myLabel.Left + 220;
myLabel.FromPane = 78;
myLabel.ToPane = 78;
myLabel.Value = "Promozionale (Y/N)";
pVal.Form.AddItem(myLabel);
myCodeText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtCode");
myCodeText.SetSizeAndPosition(TextEdit.GetFromUID(pVal.Form, "55"));
myCodeText.Left = myCodeText.Left - 50;
myCodeText.FromPane = 78;
myCodeText.ToPane = 78;
myCodeText.Enabled = false;
pVal.Form.AddItem(myCodeText);
myPromoText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtProm");
myPromoText.SetSizeAndPosition(TextEdit.GetFromUID(pVal.Form, "55"));
myPromoText.Left = myPromoText.Left + 200;
myPromoText.FromPane = 78;
myPromoText.ToPane = 78;
myPromoText.Enabled = true;
pVal.Form.AddItem(myPromoText);
//Aggiornamento finale della Form
pVal.Form.Update();
FOLDER1.GroupWith("9");
SwissAddonFramework.UI.EventHandling.ItemEvents.ClickEventHandler delFolder = null;
delFolder = delegate (SwissAddonFramework.UI.EventHandling.ItemEvents.Click ev)
{
ev.Form.PaneLevel = 78;
};
((SwissAddonFramework.UI.Components.Folder) pVal.Form.Items["CostFold"]).AddHandler_Click(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, delFolder);
}
// write the Code in the textbox
string The_Code = Get_Code("U_CodiceArticolo = '" + TextEdit.GetFromUID(pVal.Form, "5").Value + "'", "[@QTA_CDC]");
TextEdit.GetFromUID(pVal.Form, "txtCode").Value = The_Code;
string Promotion = Get_Promotion(TextEdit.GetFromUID(pVal.Form, "5").Value);
TextEdit.GetFromUID(pVal.Form, "txtProm").Value = Promotion;
TextEdit.GetFromUID(pVal.Form, "txtProm").AffectsFormMode = false;
return true;
}
catch (Exception e)
{
MessageBox.Show("Errore: " + e.Message, "OK");
return false;
}
finally
{
pVal.Form.Freeze(false);
pVal.Form.Update();
}
Can someone tell me why if I move from an item to the next one, the form goes into UDPATE mode?
Should I set a particular textbox parameter? The problem happens if the value in the textbox change moving from an item to another one.
Best regards
Emanuele
Emanuele Croci
Please, can someone help me?Emanuele
0
Please sign in to leave a comment.
Comments
0 comments