Setting the "Dirty" Flag in the close button

In the language reference, I cannot find the method for setting the black dot (dirty flag) in the close button of a macintosh document window. Can someone point me in the right direction? Thanks --Will

Window.ContentsChanged property

Gets or sets a flag that indicates whether the window has been modified. The ContentsChanged event fires when the value of this property has changed. On macOS, the window’s Close button displays a dot when ContentsChanged is True.

Sample Code

This example is in the ContentsChanged event of the control.

If Me.ContentsChanged Then MsgBox("The contents have changed!") Else MsgBox("The ContentsChanged event has not fired.") End If

P.S. So for example setting this windows property in a TextField’s TextChange event like this

Sub TextChange() Handles TextChange ContentsChanged = True End Sub

will trigger the Window’s ContentsChanged event.

However the documentation is somewhat misleading.

Put

If Me.ContentsChanged Then MsgBox("The contents have changed!") Else MsgBox("The ContentsChanged event has not fired.") End If

into the window’s ContentsChanged event.

EVERY time you type a character in the TextField the MsgBox will pop up and tell you that the contents have changed. So the ContentsChanged event is NOT only triggered when the value is changed, but EVERY time when you set the value (even the value it has had already).