/// <summary> /// Causes the block to perform data exchange between /// the field data and <paramref name="field"/> /// </summary> /// <remarks>Control data TO Field data</remarks> /// <param name="element"></param> /// <param name="field"></param> public void UpdateFieldData(int element, Field field) { UpdateField(element, field, false); }
private void UpdateField(int element, Field field, bool set_control) { if (element == -1) return; TagInterface.Definition elem = blockField.GetDefinition(element); // TODO: update this shit fool // try { elem[field.DefinitionIndex].DoDataExchange(field, set_control); } // catch (System.Exception ex) // { // Debug.LogFile.WriteLine(ex); // Debug.LogFile.WriteLine("Element index was: {0}", element); // Debug.LogFile.WriteLine("Field index was: {0}", field.DefinitionIndex); // Debug.LogFile.WriteLine("Data exchange between a '{0}' control and a '{1}' field failed on update of {2}", field.GetType(), elem[field.DefinitionIndex].GetType(), set_control ? "control" : "field data"); // } }
/// <summary> /// Causes the block to perform data exchange between /// <paramref name="field"/> and the field data at the specified element /// </summary> /// <remarks>Control data FROM Field data</remarks> /// <param name="element"></param> /// <param name="field"></param> public void UpdateFieldControl(int element, Field field) { UpdateField(element, field, true); }
public void AddField(Field f) { SuspendLayout(); f.SuspendLayout(); if (f.Attribute.IsBlockName) nameField = f; if (f.Attribute.IsHidden) f.Size = new Size(f.Width, 0); if (f.Attribute.IsReadonly) f.Enabled = false; f.Clear(); f.AddEventHandlers( OnFieldChangedTextHandler, OnFieldChangedBlockHandler, OnFieldChangedFlagHandler); f.Location = new Point(_x, _y); _y = f.Size.Height; Size = new Size(Size.Width, f.Size.Height + Size.Height); FieldView.Controls.Add(f); f.ResumeLayout(); ResumeLayout(); }