我如何在FMX中使用showmodal? [英] how do i work with showmodal in FMX?

查看:179
本文介绍了我如何在FMX中使用showmodal?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向我的主要android表单创建一个登录表单,所以我要做类似的事情

i am trying to create a login form to my main android form, so i do something like this

var
  CanGo: Boolean;

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  loginfrm := Tloginfrm.Create(nil);
    try
    loginfrm.ShowModal;
    CanGo := loginfrm.LoginSuccess = true;
  finally
    FreeAndNil(loginfrm);
  end;
  if CanGo then
  Application.Run;
end.

我一直在win32应用程序中执行此操作,并且它的工作正常,当我尝试以相同方式进行操作时在android应用程序上停止在触摸屏上并且不会显示登录表单,是android上的Show modal有所不同吗?我做错了什么?

i been doing this in win32 application and its working just fine , when i try to do the same way on android application stopped on touchscreen and wont show login form , is Show modal is different on android ? what iam doing wrong ?

推荐答案

SO上有很多类似的问题。阅读文档:

There are lots of similar questions here on SO. Read the documentation:

FMX.Forms.TCommonCustomForm.ShowModal


警告:不支持模式对话框在Android应用中。而不是调用 ShowModal ,您应该调用显示,并返回表单并调用您的事件。我们建议不要在任何一个移动平台(iOS和Android)上使用模式对话框,因为这可能导致意外行为。避免使用模式对话框,从而消除了调试和支持移动应用程序的潜在问题。

Caution: Modal dialog boxes are not supported in Android apps. Instead of calling ShowModal, you should call Show, and have the form return and call your event. We recommend do not use modal dialog boxes on either of the mobile platforms (iOS and Android) because unexpected behavior can result. Avoiding usage of modal dialog boxes eliminates potential problems in debugging and supporting your mobile apps.

有多种方法调用<$ c自从引入移动平台以来,Embarcadero提出了$ c> ShowModal 。它们都有缺陷,现在文档告诉您完全不要使用它们。

There have been different ways to call ShowModal proposed by Embarcadero since the mobile platforms were introduced. All of them had flaws, and now docs tells you not to use them at all.

这篇关于我如何在FMX中使用showmodal?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆