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, I update the textbox value but the item master data form go into UPDATE mode.
try<br>{<br> pVal.Form.Freeze(true);<br> <br> SwissAddonFramework.UI.Components.TextEdit myCodeText = null;<br> SwissAddonFramework.UI.Components.TextEdit myPromoText = null;<br> <br> try<br> {<br> //Se la form viene richiamata da un'altra form, allora la seguente istruzione genera errore<br> //dovendo ricreare tutti i componennti della TAB. Ecco il motivo del catch.<br> myCodeText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtCode");<br> myPromoText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtProm");<br> }<br> catch(System.Exception e1)<br> {<br> SwissAddonFramework.UI.Components.Folder FOLDER1 = SwissAddonFramework.UI.Components.Folder.CreateNew("CostFold");<br> FOLDER1.Top = 10;FOLDER1.Width = 400;FOLDER1.Left = 200;FOLDER1.Height = 14;<br> FOLDER1.Pane = 78;<br> FOLDER1.AffectsFormMode = false;<br> FOLDER1.Value = "Costi";<br> FOLDER1.Description = "Costi";<br> <br> pVal.Form.AddItem(FOLDER1);<br> <br> //Aggiunta etichetta<br> SwissAddonFramework.UI.Components.Label myLabel = SwissAddonFramework.UI.Components.Label.CreateNew("lblCode");<br> myLabel.SetSizeAndPosition(Label.GetFromUID(pVal.Form, "56"));<br> myLabel.Left = myLabel.Left + 10;<br> myLabel.FromPane = 78;<br> myLabel.ToPane = 78;<br> myLabel.Value = "Chiave in tabella";<br> <br> pVal.Form.AddItem(myLabel);<br> <br> myLabel = SwissAddonFramework.UI.Components.Label.CreateNew("lblProm");<br> myLabel.SetSizeAndPosition(Label.GetFromUID(pVal.Form, "56"));<br> myLabel.Left = myLabel.Left + 220;<br> myLabel.FromPane = 78;<br> myLabel.ToPane = 78;<br> myLabel.Value = "Promozionale (Y/N)";<br> <br> pVal.Form.AddItem(myLabel);<br> <br> myCodeText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtCode");<br> myCodeText.SetSizeAndPosition(TextEdit.GetFromUID(pVal.Form, "55"));<br> myCodeText.Left = myCodeText.Left - 50;<br> myCodeText.FromPane = 78;<br> myCodeText.ToPane = 78;<br> myCodeText.Enabled = false;<br> <br> pVal.Form.AddItem(myCodeText);<br> <br> myPromoText = SwissAddonFramework.UI.Components.TextEdit.CreateNew("txtProm");<br> myPromoText.SetSizeAndPosition(TextEdit.GetFromUID(pVal.Form, "55"));<br> myPromoText.Left = myPromoText.Left + 200;<br> myPromoText.FromPane = 78;<br> myPromoText.ToPane = 78;<br> myPromoText.Enabled = true;<br> <br> pVal.Form.AddItem(myPromoText);<br> <br> //Aggiornamento finale della Form<br> pVal.Form.Update();<br> <br> FOLDER1.GroupWith("9"); <br> SwissAddonFramework.UI.EventHandling.ItemEvents.ClickEventHandler delFolder = null;<br> delFolder = delegate (SwissAddonFramework.UI.EventHandling.ItemEvents.Click ev)<br> {<br> ev.Form.PaneLevel = 78;<br> };<br><br> ((SwissAddonFramework.UI.Components.Folder) pVal.Form.Items["CostFold"]).AddHandler_Click(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, delFolder);<br> }<br> <br> // write the Code in the textbox<br> string The_Code = Get_Code("U_CodiceArticolo = '" + TextEdit.GetFromUID(pVal.Form, "5").Value + "'", "[@QTA_CDC]");<br> TextEdit.GetFromUID(pVal.Form, "txtCode").Value = The_Code;<br> <br> string Promotion = Get_Promotion(TextEdit.GetFromUID(pVal.Form, "5").Value);<br> TextEdit.GetFromUID(pVal.Form, "txtProm").Value = Promotion;<br> TextEdit.GetFromUID(pVal.Form, "txtProm").AffectsFormMode = false;<br> <br> return true;<br> <br>}<br>catch (Exception e)<br>{<br> MessageBox.Show("Errore: " + e.Message, "OK");<br> return false;<br>}<br>finally<br>{<br> pVal.Form.Freeze(false);<br> pVal.Form.Update();<br>}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
0
Please sign in to leave a comment.
Comments
0 comments