Task Dialog, Android : on close it switches back to the main form

Hello,

TTMSFNCTaskDialog behaved differently in the last year's version.
I have a MainForm and on the top of that another form, let's call it DailyTaskForm.
When the user clicks on a button on DailyTask Form, I show the Task dialog.

With the previous FNC versions, on Android systems when the user closed the Task dialog, the DailyTask Form was visible again : this was the correct behavior.

However with the new version, after user closes the Task dialog, the Mainform is visible!
I had a very awkward situation that after a new version of my app, customers kept calling me that they can't work with the app since whatever they do, they keep getting back on the main form. And they demand solution.
I tried to show the DailyTask Form again after closing the task dialog, but that causes flickers and it is slow (the user has to wait for about a second or two).

How can I solve this? Is this a setting for this unwanted behaviour?
Thank you!

Hi,

We did not make any changes to the TTMSFNCPopup or TTMSFNCTaskDialog that would affect closing on Android. However, we've encountered this before, it is usually caused by how the popup is closed. What works in a Delphi version will not work in another - it's unclear why this happens.

As a temporary solution we added the UseIsOpen public property for the FMXMOBILE define only (so you can use it with the ANDROID and/or IOS defines separately as well). This property is enabled by default and it let's you switch between the two closing mechanisms. Try setting it to False before opening the dialog. If it still doesn't work then please prepare a small sample that reproduces the issue so we can try to investigate.

Hi Tünde,

Thank you for your reply.
I downloaded the newest version and in the unit FMX.TMSFNCTaskDialog, UseIsOpen is not public, but private .
However I changed the constructor TTMSFNCCustomTaskDialog.Create(AOwner: TComponent); so as FUseIsOpen := False;

... then recompiled the whole project but nothing changed.

I use this function in my Android application (it is simplified):

Type
   Pt_GeneralProcedure = reference to Procedure(ModalResult:TModalResult);	
Function TClassFmxGeneralSelections.FAjk_SelectFinishedMemo(Const sValue:String;pRunThisProcedure: Pt_GeneralProcedure=nil): String;
begin
  
  Var MyMemo : TMemo       := TMemo.Create(TaskDialog);//uses FMX.Memo
  MyMemo.Parent            := TaskDialog;
  MyMemo.Text              := sValue;
  MyMemo.Width             := 300;
  MyMemo.Height            := 200;

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


  {$REGION 'Timer'} //
  Var MyTimer := TTimer.Create(nil);
  with MyTimer do    // uses Fmx.Types
   begin
     Interval := 10;

     OnTimer :=
     AnonProc2NotifyEvent(
       MyTimer,
       procedure(Sender: TObject)
       begin
         MyMemo.SetFocus;
         MyTimer.Enabled     := False;//Because it runs only once
       end
     ) ;
     Enabled := True;
   end;
  {$ENDREGION} //

  TaskDialog.Execute(
  procedure(ModalResult: TModalResult)
  begin
    
    Case ModalResult of
      mrOk:
       Begin
         TaskDialog.InputText := MyMemo.Text;
         If Assigned(pRunThisProcedure) Then
          Begin
            pRunThisProcedure(ModalResult) ;
          End;
       end;
    End;

  end);
  

end;

And I call the function like this:

  GeneralSelection.FAjk_SelectFinishedMemo( FieldByName('WorkDescriptionMSZ').AsString,
    Procedure(ModalResult:TModalResult)    
     Begin
       If GeneralSelection.TaskDialog.InputText<>'' Then
        Begin
          Try
          pv_MyDataSet.Edit;
          pv_MyDataSet.FieldByName('WorkDescriptionMSZ').AsString := GeneralSelection.TaskDialog.InputText;
          pv_MyDataSet.Post;
          ButtonMegjegyzes.Appearance.NormalStroke.Color := TAlphaColors.Springgreen;
        End;
     End);

Hi Zsolt,

UseIsOpen was never private so it can only be public:


However, modifying the sources to set FUseIsOpen to False directly should have the same effect.

We tried your snippet but it is working as expected here. We will need more context to continue with the investigation. Can you please provide the following:

  • Delphi version
  • Android version
  • A minimal sample project that reproduces the issue (supposedly this will only be a main form, a child form, the task dialog along with some buttons/memos).

Hi Tünde,

Delphi version: Embarcadero® RAD Studio 12 Version 29.0.53571.9782
Android: 10
I have attached a test project which demonstrates it.
TmsTaskDialogTest_2025-02-04_08-36-57.zip (21.4 KB)

Thank you

Hi Zsolt,

With the sample project we were able to reproduce it. Not sure when was the last time you updated TMS FNC UI Pack, but there was a change mid-2024 in TTMSFNCPopup that could be the reason. Unfortunately we cannot revert that change as it is necessary for the TTMSFNCPopup and other UI controls that utilize it.

However we noticed the issue is resolved if the Owner of the TTMSFNCTaskDIalog is set to the form it is being executed from instead of the main form.

If that is not a solution you can use, then we can introduce a Boolean property at TTMSFNCTaskDialog level that will allow you to disable the modification in TTMSFNCPopup.