Detecting changes


Author
Message
Neil Turp
Neil Turp
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 0, Visits: 166
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?

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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.


Best Regards,
Nevron Support Team


Neil Turp
Neil Turp
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 0, Visits: 166
Excellent thanks.  Just what I needed and no need to monitor it myself.

Tom Galczynski
Tom Galczynski
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 29, Visits: 87
"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!

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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...

Best Regards,
Nevron Support Team


Tom Galczynski
Tom Galczynski
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 29, Visits: 87
Perfect.  Just what I needed.  Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search