Posted 11 December 2019, 8:37 am EST - Updated 30 September 2022, 1:40 pm EST
I am getting a crash while trying to edit the cell, we are using a wrapper over EditBaseCellType and using an instance of Windows.forms inside it.
The issue happens when we edit the cell for the first time and StopEditing event gets calls Dispose() for the base class, where the control gets disposed.
Next time when we try to access control we get the crash, this issue was not happening in v7.35 and happens only after the upgrade.
if I override the InitializeEditorControl and instantiate the form object there the issue gets resolved,
is this the right way to do?
I am providing the methods
public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{ UserControl ResultNumeric accept = null;
accept.LessThan = false;
accept.GreaterThan = false;
accept.NumericResult = 0;
accept.NumericResultString = " ";
accept.SetResultFormat(m_dataMapMin, m_dataMapMax, m_dataMapDec);
accept.SciNotationItemName = this.SciNotationItemName;
accept.SuppressGreaterLessThan = this.SuppressGreaterLessThan;
accept.AssayName = this.AssayName;
return accept;
}
// this implementation resolves the issue
public override void InitializeEditorControl(Control control, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{
accept = new ResultNumeric();
base.InitializeEditorControl(control, appearance, zoomFactor);
}
public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{
base.GetEditorControl(appearance, zoomFactor);
accept.LessThan = false;
accept.GreaterThan = false;
accept.NumericResult = 0;
accept.NumericResultString = " ";
accept.SetResultFormat(m_dataMapMin, m_dataMapMax, m_dataMapDec);
accept.SciNotationItemName = this.SciNotationItemName;
accept.SuppressGreaterLessThan = this.SuppressGreaterLessThan;
accept.AssayName = this.AssayName;
return accept;
}