Bug in spread 4.0.3515 2008 combobox

Posted by: dotnetuser on 8 September 2017, 2:14 pm EST

  • Posted 8 September 2017, 2:14 pm EST

    Installed version 4.0.3515 2008 of the spread and getting the following error:


     


    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.


    ************** Exception Text **************
    System.Exception: Exception handled in FpSpread.WndProc ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at FarPoint.Win.SuperEditBase.set_ControlType(ControlType value)
       at FarPoint.Win.FpCombo.set_Editable(Boolean value)
       at FarPoint.Win.Spread.CellType.ComboBoxCellType.InitializeEditorControl(Control control, Appearance appearance, Single zoomFactor)
       at FarPoint.Win.Spread.CellType.BaseCellType.GetReusableEditorControl(IReuseEditorControl irec, Control parent, Appearance appearance, Single zoomFactor)
       at FarPoint.Win.Spread.CellType.ComboBoxCellType.GetEditorControl(Control parent, Appearance appearance, Single zoomFactor)
       at FarPoint.Win.Spread.SpreadView.StartCellEditing(EventArgs e, Boolean formula)
       at FarPoint.Win.Spread.SpreadView.a(Int32 A_0, Int32 A_1, MouseEventArgs A_2)
       at FarPoint.Win.Spread.SpreadView.g(MouseEventArgs A_0)
       at FarPoint.Win.Spread.FpSpread.OnMouseDown(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at FarPoint.Win.Spread.FpSpread.WndProc(Message& m)
       --- End of inner exception stack trace ---
       at FarPoint.Win.Spread.FpSpread.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    Create a new window appliation in .Net 2008:


    Add a MDIparent screen.


    Add a button to the MDIParent screen that will display Form1.


    Form1 f = new Form1();


    f.Show();


    In Form1 plop the following code:


     


    namespace FarpointSQL2008CBOTesting


    {


    public partial class Form1 : Form


    {


    public Form1()


    {


    InitializeComponent();


    }


    private void Form1_Load(object sender, EventArgs e)


    {


    fpSpread1.Sheets[0].ColumnCount = 0;


    fpSpread1.SuspendLayout();


     


    fpSpread1.Sheets[0].RowCount = 2;


    fpSpread1.Sheets[0].ColumnCount = 4;


    FarPoint.Win.Spread.CellType.ComboBoxCellType cboCellType = new FPComboCellType();


    string[] strCBO1 = new string[3];


     


    strCBO1[0] = "Item 1";


    strCBO1[1] = "Item 2 CCCCCCCCCCCCCCCCCCCCC";


    strCBO1[2] = "Item 3 CCCCCCCCCCCCCCCCCCCCC";


    cboCellType.Items = strCBO1;


     


    fpSpread1.Sheets[0].Columns[0].CellType = cboCellType;


    fpSpread1.Sheets[0].Columns[0].Label = "Native CBO 1";


     


    cboCellType = null;


    cboCellType = new FPComboCellType();


    string[] strCBO2 = new string[10];


    strCBO2[0] = "Item Long 1";


    strCBO2[1] = "Item Long 2 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[2] = "Item Long 3 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[3] = "Item Long 4 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[4] = "Item Long 5 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[5] = "Item Long 6 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2Devil = "Item Long 7 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[7] = "Item Long 8 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2Music = "Item Long 9 CCCCCCCCCCCCCCCCCCCCC";


    strCBO2[9] = "Item Long 10 CCCCCCCCCCCCCCCCCCCCC";


    cboCellType.Items = strCBO2;


    fpSpread1.Sheets[0].Columns[1].CellType = cboCellType;


    fpSpread1.Sheets[0].Columns[1].Label = "Native CBO 2";


     


     


    FarpointSQL2008CBOTesting.FPComboCellType fpCombo = new FPComboCellType();


     


    string[] strCBO3 = new string[3];


     


    strCBO3[0] = "Item 1";


    strCBO3[1] = "Item 2 CCCCCCCCCCCCCCCCCCCCC";


    strCBO3[2] = "Item 3 CCCCCCCCCCCCCCCCCCCCC";


    fpCombo.Items = strCBO1;


    cboCellType = null;


    cboCellType = new FPComboCellType();


    fpSpread1.Sheets[0].Columns[2].CellType = fpCombo;


    fpSpread1.Sheets[0].Columns[2].Label = "My Custom Combo CBO 1";


    fpCombo = null;


    fpCombo = new FarpointSQL2008CBOTesting.FPComboCellType();


    string[] strCBO4 = new string[10];


     


    strCBO4[0] = "Item Long 1";


    strCBO4[1] = "Item Long 2 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[2] = "Item Long 3 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[3] = "Item Long 4 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[4] = "Item Long 5 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[5] = "Item Long 6 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4Devil = "Item Long 7 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[7] = "Item Long 8 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4Music = "Item Long 9 CCCCCCCCCCCCCCCCCCCCC";


    strCBO4[9] = "Item Long 10 CCCCCCCCCCCCCCCCCCCCC";


    fpCombo.Items = strCBO4;


    fpSpread1.Sheets[0].Columns[3].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Justify;


    fpSpread1.Sheets[0].Columns[3].CellType = fpCombo;


    fpSpread1.Sheets[0].Columns[3].Label = "My Custom Combo CBO 2";


     


     


     


     


    fpSpread1.Sheets[0].Cells[0, 0].Text = "Item 1";


     


    fpSpread1.Sheets[0].Cells[0, 1].Text = "Item Long 1";


     


     


    fpSpread1.Sheets[0].Cells[0, 2].Text = "Item 1";


     


    fpSpread1.Sheets[0].Cells[0, 3].Text = "Item Long 1";


     


    fpSpread1.ResumeLayout();


     


    }


    }


    }


    And last but not least the here is the code for the  FPComboCellType it has been given by you in a previous post to simulate the old behavior of the combo box that was changed with the latest versions:


     


    public class FPComboCellType : FarPoint.Win.Spread.CellType.ComboBoxCellType


    {


    private ADDFPCombo cNew = null;


    public override System.Windows.Forms.Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, Single zoomFactor)


    {


    FarPoint.Win.FpCombo cOrig;


    cOrig = (FarPoint.Win.FpCombo)(base.GetEditorControl(appearance, zoomFactor));


    cNew = new ADDFPCombo();


    cNew.Formatter = cOrig.Formatter;


    cNew.ButtonStyle = cOrig.ButtonStyle;


    cNew.AutoHeight = cOrig.AutoHeight;


    cNew.BorderStyle = cOrig.BorderStyle;


    cNew.Editable = cOrig.Editable;


    cNew.Multiline = cOrig.Multiline;


    cNew.WordWrap = cOrig.WordWrap;


    cNew.AcceptsReturn = cOrig.AcceptsReturn;


    cNew.ListOffset = cOrig.ListOffset;


    cNew.List = cOrig.List;


    cNew.MaxDrop = cOrig.MaxDrop;


    cNew.ListWidth = cOrig.ListWidth;


    cNew.MarginLeft = cOrig.MarginLeft;


    cNew.AutoSearch = cOrig.AutoSearch;


    cNew.ListAlignment = cOrig.ListAlignment;


    cNew.MaximumLength = cOrig.MaximumLength;


    cNew.ButtonWidth = cOrig.ButtonWidth;


    cNew.AcceptsArrowKeys = cOrig.AcceptsArrowKeys;


    cNew.ListControl = cOrig.ListControl;


    cNew.NullColor = cOrig.NullColor;


    cNew.ForeColor = cOrig.ForeColor;


    cNew.Font = cOrig.Font;


    return cNew;


    } //GetEditorControl


    public override object GetEditorValue()


    {


    switch (EditorValue)


    {


    case FarPoint.Win.Spread.CellType.EditorValue.String:


    {


    return cNew.Text;


    }


    case FarPoint.Win.Spread.CellType.EditorValue.Index:


    {


    return cNew.SelectedIndex;


    }


    }


    return null;


    } //GetEditorValue


    public override void SetEditorValue(object value)


    {


    if (cNew == null)


    return;


    if (value == null | value == DBNull.Value)


    {


    cNew.SelectedIndex = -1;


    if (Editable & cNew != null)


    cNew.Text = null;


    }


    else


    {


    if (EditorValue == FarPoint.Win.Spread.CellType.EditorValue.String)


    {


    string s = value.ToString();


    if (ListControl != null)


    {


    if (ListControl.FindString(s) != -1 | cNew.Editable)


    cNew.Text = s;


    }


    else


    {


    if (cNew.List.Contains(s) | cNew.Editable)


    cNew.Text = s;


    if (cNew.List.Contains(s))


    cNew.SelectedItem = s;


    }


    }


    else


    {


    if (EditorValue == FarPoint.Win.Spread.CellType.EditorValue.Index)


    {


    int index = -1;


    try


    {


    index = Convert.ToInt32(value);


    }


    catch


    {


    }


    cNew.SelectedIndex = index;


    }


    else


    cNew.SelectedIndex = -1;


    }


    }


    }


    public override bool StopEditing()


    {


    if (cNew != null)


    {


    cNew.ShowList(false);


    }


    FireEditingStopped();


    if (cNew != null)


    {


    cNew.Dispose();


    cNew = null;


    }


    return true;


    } //StopEditing


    public override void StartEditing(EventArgs e, bool selectAll, bool autoClipboard)


    {


    if (!((e == null) | (cNew == null)))


    {


    Rectangle rc = cNew.Bounds;


    Rectangle rectButton = new Rectangle(rc.X + rc.Width - 14, rc.Y, 14, rc.Height);


    if (e is MouseEventArgs && !Editable && !(rectButton.Contains(new Point(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y))))


    {


    cNew.Focus();


    cNew.ShowList(true);


    }


    else


    {


    if (selectAll & Editable)


    {


    cNew.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.SelectAll;


    cNew.SelectAll();


    }


    else


    cNew.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.End;


    if ((e is KeyPressEventArgs) & (!(Editable)))


    {


    int WM_CHAR = 258;


    Message m = Message.Create(cNew.Handle, WM_CHAR, new IntPtr(System.Convert.ToInt32(((KeyPressEventArgs)e).KeyChar.ToString())), new IntPtr(0));


    cNew.WindowTarget.OnMessage(ref m);


    }


    }


    }


    } //StartEditing


    public override void CancelEditing()


    {


    if ((cNew != null))


    {


    cNew.ShowList(false);


    }


    FireEditingCanceled();


    if (cNew != null)


    {


    cNew.Dispose();


    cNew = null;


    }


    //CancelEditing


    } //myComboCellType


    public class ADDFPCombo : FarPoint.Win.FpCombo


    {


    protected override bool IsInputKey(Keys keyData)


    {


    if (keyData == Keys.Return)


    {


    return false;


    }


    return base.IsInputKey(keyData);


    } //IsInputKey


    protected override void WndProc(ref Message m)


    {


    switch (m.Msg)


    {


    case 0X102: // WM_CHAR


    if (true)


    {


    if (m.WParam.ToInt32() == 13)


    return;


    }


    break;


    }


    base.WndProc(ref m);


    } //WndProc


    }


    }


    }


    Just open those comboboxes and you should have easily this error.


     


     

  • Replied 8 September 2017, 2:14 pm EST

    Hello,

    I have reported this issue as a bug(# 99914534) to our QA team.This should be fixed in our next maintenance release of Spread for Windows Forms.

     

    Thanks,

     

  • Replied 8 September 2017, 2:14 pm EST

    Can we expect the next maintenance release soon? In a few days?


    If not when should we expect it?

  • Replied 8 September 2017, 2:14 pm EST

    Hello,

    As of now we do not have the expected dates for the availability of next maintenance release of Spread. We try to make the maintenance build available in every 3 months (as per last year's trend). We will notify about the availability of same, as we have already forwarded this to the concerned team

    Thanks

  • Replied 8 September 2017, 2:14 pm EST

    The current release we’re using is 4.0.3509 and it has major issues with scrolling in the spread. We’re really hoping that 4.0.3515 2008 will take care of this problem to our surprise 4.0.3515 2008 has more serious problem. So we’re kind of stuck now and we we’re really hoping to get this fixed ASAP.
  • Replied 8 September 2017, 2:14 pm EST

    Hello,

    This issue is not addressed in this build of Spread 4.I reported this issue after testing with 4.0.3515.2008 as the issue was replicable with this version too. The next maintenance release of Spread will be out in the middle of April, it should have this issue fixed.

    Thanks,

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels