IsDirty: Boolean;
IsDirty: boolean;
The IsDirty property returns whether the model displayed by the component is changed.
Available values:
True. The model is changed. To save changes, use the IModelBox.SaveObject method.
False. Model has not changed.
Executing the example requires a form, a button with the Button1 identifier on the form, the ModelBox component with the ModelBox1 identifier and the UiModel component that is a data source for ModelBox1. A model must be loaded to UiModel.
Add a link to the Ui system assembly. This code is handler of the OnClick event for the Button1 button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
yes: Boolean;
Begin
If ModelBox1.IsDirty Then
WinApplication.YesNoCancelBox("The model has changed. Do you want to save changes?", yes);
If yes Then
ModelBox1.SaveObject;
End If;
Else
WinApplication.InformationBox("The model has not changed");
End If;
End Sub Button1OnClick;
Example execution result: if the displayed model is changed, it is prompted to save changes.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Ui;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
WinApp: WinApplicationClassClass;
yes: Boolean;
Begin
WinApp := New WinApplicationClassClass.Create();
If modelBoxNet1.CtrlBox.IsDirty Then
WinApp.YesNoCancelBox("The model is changed. Do you want to save changes?", Var yes, Null);
If yes Then
modelBoxNet1.CtrlBox.SaveObject();
End If;
Else
WinApp.InformationBox("Model has not changed", Null);
End If;
End Sub;
See also: