Group: Forum Members
Last Active: 7 Years Ago
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 .& nbsp ; I ' ve tried using . Content . Changed . Content . ModifiedChanged .&# 100 ; ocument . Changed .&# 100 ; ocument . ModifiedChanged None of them fire reliably as I type , paste , delete , cut .& nbsp ; The first one fires when moving a mouse over the control , or sometimes on a keypress but not always .& nbsp ; Can anyone point me towards what I ' m missing ?
|
Group: Forum Members
Last Active: Last Month
Posts: 3,055,
Visits: 4,055
|
Hi Neil , You can use the Modified property of the document to check whether the document has changed : nRichTextView WithRibbonControl1 . Widget . View .&# 100 ; ocument . Modified If you wish to track when the property is raised you can also subscribe to the document ' s & nbsp ; ModifiedChanged event . Let us know if you meet any problems or have any questions .
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 7 Years Ago
Posts: 0,
Visits: 166
|
Excellent thanks. Just what I needed and no need to monitor it myself.
|
Group: Forum Members
Last Active: 5 Years Ago
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!
|
Group: Forum Members
Last Active: Last Month
Posts: 3,055,
Visits: 4,055
|
Hi Tom , We just checked with the following VB code and it was working correctly : Public Class Form1 & nbsp ; Private Sub Form1_Load ( sender As Object , e As EventArgs ) Handles MyBase . Load & nbsp ;& nbsp ; AddHandler Me . NRichTextViewControl1 . Widget .&# 100 ; ocument . ModifiedChanged , AddressOf Me . EventHandler & nbsp ; End Sub & nbsp ; Sub EventHandler ( eventArgs As Nevron . Nov . Dom . NEventArgs ) & nbsp ;& nbsp ; ' Handle the event . & nbsp ;& nbsp ; MsgBox (" Document Changed .") & nbsp ; 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 & nbsp ; Private Sub Form1_Load ( sender As Object , e As EventArgs ) Handles MyBase . Load & nbsp ;& nbsp ; Me . NRichTextViewControl1 . Widget .&# 100 ; ocument . Modified = False & nbsp ;& nbsp ; AddHandler Me . NRichTextViewControl1 . Widget .&# 100 ; ocument . ModifiedChanged , AddressOf Me . EventHandler & nbsp ; End Sub & nbsp ; Sub EventHandler ( eventArgs As Nevron . Nov . Dom . NEventArgs ) & nbsp ;& nbsp ; ' Handle the event . & nbsp ;& nbsp ; MsgBox (" Document Changed .") & nbsp ; End Sub End Class Also what type is & nbsp ; RichTextEdit1 ? Let us know if the problem persists ...
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 5 Years Ago
Posts: 29,
Visits: 87
|
Perfect. Just what I needed. Thanks!
|