By Neil Turp 1 - Thursday, January 11, 2018
Hi I am writing an app that has to detect if a document has changed, so it can prompt to save or cancel. I've tried using .Content.Changed .Content.ModifiedChanged .document.Changed .document.ModifiedChanged None of them fire reliably as I type, paste, delete, cut. The first one fires when moving a mouse over the control, or sometimes on a keypress but not always. Can anyone point me towards what I'm missing?
|
By Nevron Support - Friday, January 12, 2018
Hi Neil, You can use the Modified property of the document to check whether the document has changed: nRichTextViewWithRibbonControl1.Widget.View.document.Modified
If you wish to track when the property is raised you can also subscribe to the document's ModifiedChanged event. Let us know if you meet any problems or have any questions.
|
By Neil Turp 1 - Friday, January 12, 2018
Excellent thanks. Just what I needed and no need to monitor it myself.
|
By Tom Galczynski - Friday, February 8, 2019
"If you wish to track when the property is raised you can also subscribe to the document's ModifiedChanged event." Hello. I'm trying to handle the above event but I can't seem to get it to fire. Is there some code examples showing how to set this up so any edit in the UI of the rich edit control can be known? Or some further documentation on exactly when the document's event is fired? I'm using Vb.Net and am adding a handler in my form: AddHandler Me.RichTextEdit1.document.ModifiedChanged, AddressOf Me._richTextEdit_TextChanged
Thanks!
|
By Nevron Support - Monday, February 11, 2019
Hi Tom, We just checked with the following VB code and it was working correctly: Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load AddHandler Me.NRichTextViewControl1.Widget.document.ModifiedChanged, AddressOf Me.EventHandler End Sub
Sub EventHandler(eventArgs As Nevron.Nov.Dom.NEventArgs) ' Handle the event. MsgBox("Document Changed.") End Sub End Class When do you subscribe for this event - it may be that at the time when you subscribe the changed flag is already raised - to test this simply reset the flag before you subscribe: Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.NRichTextViewControl1.Widget.document.Modified = False AddHandler Me.NRichTextViewControl1.Widget.document.ModifiedChanged, AddressOf Me.EventHandler End Sub
Sub EventHandler(eventArgs As Nevron.Nov.Dom.NEventArgs) ' Handle the event. MsgBox("Document Changed.") End Sub End Class Also what type is RichTextEdit1? Let us know if the problem persists...
|
By Tom Galczynski - Tuesday, February 12, 2019
Perfect. Just what I needed. Thanks!
|
|