TMSFNCTaskDialog: Prevent closing depending on some value

Hello,

Can I somehow prevent closing TMSFNCTaskDialog window?
Let's say I have an Fnc edit on it:

Var MyEdit : TTMSFNCEdit := TTMSFNCEdit.Create(TaskDialog);//uses FMX.TMSFNCEdit
MyEdit.Parent := TaskDialog;
MyEdit.EditType := etNumeric;
MyEdit.Text := 0 ;
MyEdit.Width := 100;

TaskDialog.InputType := titCustom; // titEdit titDate titCustom titNone
TaskDialog.InputControl := MyEdit;

TaskDialog.Execute(
procedure(ModalResult: TModalResult)
begin
case ModalResult of
mrOk:
Begin
TaskDialog.InputText := MyEdit.Text;
Do something else

   end;
End;

end);

... and I would like to allow to be closed only if the user enters a number between 1 and 49 (e.g. 49 is the maximum piece the customer can take of the selected product).
First I thought of the OnDialogButtonClick, but this doesn't have a parameter to block closing it like the OnCloseQuery event for a form (CanClose parameter).

Thank you!

Hi,

Right now this is not possible to do, however it's a good suggestion to have an event for this purpose. We added OnBeforeCloseDialog with a var Boolean parameter to block the closing of the dialog. The next version will contain this new event.

1 Like

Thank you very much!