what event fires on .settext?

Posted by: ginacresse on 8 September 2017, 12:59 pm EST

  • Posted 8 September 2017, 12:59 pm EST

    Can you tell me what event fires when I perform .settext on a textbox in a spread?  It's not TextChanged or any others that seem the logical choice.


     


    Thanks,


    Gina

  • Replied 8 September 2017, 12:59 pm EST

    With CellChanged, it seemed to fire if I locked or unlocked the spread, and if I populated a combobox (which makes sense, but I didn't want that to trigger my code).  I'll try your other suggestions.


    Thanks!

  • Replied 8 September 2017, 12:59 pm EST

    Gina -

    The easiest event to use would be the FpSpread1_Sheet1_CellChanged event.
  • Replied 8 September 2017, 12:59 pm EST

    Thanks, Bob.  I did try the cellchange event, but it fires too often for my purposes.  I finally just put the call to the code I need in the subs that do the .settext command.


    Any idea if the textchanged event will ever be functional?  I can't seem to find any time when it fires.


    Thanks,


    Gina

  • Replied 8 September 2017, 12:59 pm EST

    Gina -

    I'm not sure I understand when you say it fires 'too often'.  Be that as it may, the spread control consists of rows and columns of cells that each have their own text property which is different from the text property of that spread inherits from the control class.  Since spread does not use the control’s Text property, the
    TextChange event is never raised.  I suppose you could try creating a custom cell type that has a TextBox as the editor and map it's TextChanged event to see if that suits your purpose.  Or you could try mapping the Changed event for the data model and see if that is what you are looking for.
  • Replied 8 September 2017, 12:59 pm EST

    Yes, that would be the case with CellChanged.  Use the Changed event of the data model instead.
  • Replied 8 September 2017, 12:59 pm EST

    Okay, this sounds promising.  I'm just not sure how to access the data model event.  I only see the equivalent of fpSpread1 and fpSpread1_Sheet1 in my controls list. 
  • Replied 8 September 2017, 12:59 pm EST

    Try the following...

    Global declaration -

    Friend WithEvents dm As FarPoint.Win.Spread.Model.DefaultSheetDataModel


    Form Load -

    dm = FpSpread1.ActiveSheet.Models.Data
    AddHandler dm.Changed, AddressOf dm_Changed

    Private Sub dm_changed(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.Model.SheetDataModelEventArgs)

    End Sub
  • Replied 8 September 2017, 12:59 pm EST

    Okay, I found the example code in Help.  I added the handler and it works great.


    Thanks, Bob!

Need extra support?

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

Learn More

Forum Channels