/// <summary> /// Edit a new or existing calculated field /// </summary> /// <param name="cf"></param> /// <param name="uoIn"></param> /// <returns></returns> public static UserObject Edit( CalcField cf, UserObject uoIn) { QueryTable qt; MetaTable mt = null; MetaColumn mc, field; UserObject uo2; CalcField cf2 = null; string msg; int i1; CalcFieldEditor lastInstance = Instance; CalcFieldEditor i = Instance = new CalcFieldEditor(); i.AdvancedPanel.BorderStyle = BorderStyle.None; i.AdvancedPanel.Visible = false; i.AdvancedPanel.Dock = DockStyle.Fill; i.BasicPanel.BorderStyle = BorderStyle.None; i.BasicPanel.Visible = true; i.BasicPanel.Dock = DockStyle.Fill; i.SetupStandardCalculatedFields(); if (ServicesIniFile.Read("CalcFieldHelpUrl") != "") { i.Help.Enabled = true; } if (lastInstance != null) { i.StartPosition = FormStartPosition.Manual; i.Location = lastInstance.Location; i.Size = lastInstance.Size; lastInstance = null; } if (uoIn == null) { uoIn = new UserObject(UserObjectType.CalcField); } else if (uoIn.Id > 0) // get existing metatable for calc field for exclusion in BuildQuickSelectTableMenu { string tName = "CALCFIELD_" + uoIn.Id.ToString(); mt = MetaTableCollection.GetExisting(tName); if (MainMenuControl != null) { MainMenuControl.UpdateMruList(tName); } } Instance.UoIn = uoIn; string title = "Edit Calculated Field"; if (!String.IsNullOrEmpty(uoIn.Name)) { title += " - " + uoIn.Name; } Instance.Text = title; Instance.CalcField = cf; // what we're editing Instance.SetupForm(); // set up the form DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm); if (dr == DialogResult.Cancel) { return(null); } return(Instance.UoIn); // return saved object }