Custom TextCellType no longer working in Spread 5

Posted by: silkkeng-fp on 8 September 2017, 2:17 pm EST

  • Posted 8 September 2017, 2:17 pm EST

    Hi,

    I have attached a sample project.

    This was working fine in Spread 4.0.2003.2005; but no longer working in Spread 5.0.2003.2008.

    Steps:

    1.  run project

    2. double click on row 1, and type something. You will realise that big text box span through whole sheetview appears to let you type something.

    3. double click on row 2, and type something. You will notice that the CellType's Parent is NOTHING at the StartEditing event. But it was not NOTHING in Step 2. 

    4. Try double click on row 3, and you get the same error as Step 3. 

    Why is the CellType's Parent become NOTHING while in step 3 and 4?

    OR, Is there something I did wrong in the first place?

     


    There are 2 GetEditorControl method, GetEditorControl(Appearance, Single) and GetEditorControl(Control, Appearance, Single).

     Can you please also explain the difference between these two? 

    Thanks






    2010/04/SpreadTest070410.rar
  • Replied 8 September 2017, 2:17 pm EST

    Hello,


    We are able to see the behaviour mentioned by you. For now with version 5, I would suggest you using a different overload of GetEditorControl() rather than the one you have used.



    Public Overrides Function GetEditorControl(ByVal parentControl As Control, ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal zoomFactor As Single) As System.Windows.Forms.Control


    And we are forwading your request to the concerned team for further clarification on the same, will update you soon.


    Thanks.

  • Replied 8 September 2017, 2:17 pm EST

    Silkkeng,

    We have got the response from the concerned team regarding your issue. In Spread 5, the built-in cell types have a new interface implemented, IReuseEditorControl, for optimizing the use of the editor control by the cell type.  Earlier in version 4, SpreadView would always Dispose the editor control when the user left edit mode, and recreate it when the user enters edit mode again. 


    However, In Spread 5, the new interface has an overload for CreateEditorControl with the parent passed in, so the control can be created and added to the parent's controls collection, then retrieved from it again the next time, and SpreadView does not dispose the control when the cell type implements this interface, and calls the InitializeEditorControl to reinitialize the control for editing the cell before starting editing with the control.

    Since you have implemented a custom cell type inheriting from a built-in cell type, therefore it will get this interface inherited too and SpreadView will no longer call the old overload for CreateEditorControl.

    I hope you will appreciate the change done because it is more efficient to keep the editor control and reuse it than to recreate it each time and burden the garbage collector.


    Hope this above mentioned information will help you.

    Thanks.

Need extra support?

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

Learn More

Forum Channels