FMX.Platform.TApplicationEvent

FMX.Platform.TApplicationEvent

http://docwiki.embarcadero.com/Libraries/XE8/en/FMX.Platform.TApplicationEvent

TApplicationEvent = (FinishedLaunching, BecameActive, WillBecomeInactive, EnteredBackground, WillBecomeForeground, WillTerminate, LowMemory, TimeChange, OpenURL);

An instance of TApplicationEvent may have any of the following values:

Item Description Platform
Android iOS

BecameActive


Your application has gained the focus.


Supported


Supported


EnteredBackground


The user is no longer using your application, but your application is still running in the background.


Supported


Supported


FinishedLaunching


Your application has been launched.


Supported


Supported


LowMemory


This warns your application that the device is running out of memory.

Your application should reduce memory usage, freeing structures and data that can be loaded again at a later point.


Supported


Supported


OpenURL


You application has received a request to open an URL.

Application events of this type are usually associated with a context. This context is an instance of the iOS-only TiOSOpenApplicationContext class, which provides the following read-only properties:

  • TiOSOpenApplicationContext.SourceApp is a string that contains the bundle ID of the application that requested your application to open the URL.
  • TiOSOpenApplicationContext.URL is the URL to open, either a network resource or a file.
  • TiOSOpenApplicationContext.Context is a pointer to a property-list object that might provide additional information.

See the iOS API reference documentation for more information.

 
Supported


TimeChange


There has been a significant change in time.

This event might happen for example when the day changes or when the device changes to or from daylight savings time.

 
Supported


WillBecomeForeground


The user is now using your application, which was previously in the background.


Supported


Supported


WillBecomeInactive


Your application is going to loose the focus.


Supported


Supported


WillTerminate


The user is quitting your application.


Supported


Supported

http://codeverge.com/embarcadero.delphi.ios/ifmxapplicationeventservice-not-firing/2028062

http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583

procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf

procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf


procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf


http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583

procedure TMainForm.FormCreate( Sender : TObject );
  var
    SvcEvents : IFMXApplicationEventService;
begin
    if TPlatformServices.Current.SupportsPlatformService
      ( IFMXApplicationEventService, IInterface( SvcEvents ) )
    then
      SvcEvents.SetApplicationEventHandler( HandleAppEvent );
    Application.OnException := ExceptionHandler;
end;

function TMainForm.HandleAppEvent(   AAppEvent : TApplicationEvent;   AContext  : TObject ) : Boolean;
begin
    case AAppEvent of
      TApplicationEvent.FinishedLaunching :
        ;
      TApplicationEvent.BecameActive :
        ;
      TApplicationEvent.WillBecomeInactive :
        ;
      TApplicationEvent.EnteredBackground :
        ;
      TApplicationEvent.WillBecomeForeground :
        ;
      TApplicationEvent.WillTerminate :
        ;
      TApplicationEvent.LowMemory :
        ;
      TApplicationEvent.TimeChange :
        ;
      TApplicationEvent.OpenURL :
        ;
    end;
    Result := True;
end;
//See more at : http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583

procedure TMainForm.FormCreate(Sender: TObject); var SvcEvents: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(SvcEvents)) then SvcEvents.SetApplicationEventHandler(HandleAppEvent); Application.OnException := ExceptionHandler; end; function TMainForm.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of TApplicationEvent.FinishedLaunching: ; TApplicationEvent.BecameActive: ; TApplicationEvent.WillBecomeInactive: ; TApplicationEvent.EnteredBackground: ; TApplicationEvent.WillBecomeForeground: ; TApplicationEvent.WillTerminate: ; TApplicationEvent.LowMemory: ; TApplicationEvent.TimeChange: ; TApplicationEvent.OpenURL: ; end; Result := True; end; - See more at: http://codeverge.com/embarcadero.delphi.firemonkey/keep-application-on-top/2009583#sthash.6XM5jEUI.dpuf

时间: 2024-08-09 14:48:54

FMX.Platform.TApplicationEvent的相关文章

XE6 FMX之控件绘制与显示

FMX是一套UI类库,就相当于以前的VCL,但是相比VCL来说,支持了跨平台,同时也直接内部支持了各种特效动画甚至3D的效果,如果效率性能上来了,这个类库还是很有前景的.这次我主要学习的就是一个FMX窗体是如何绘制并显示出来的,相比较于VCL,有哪些不同之处,以及一个FMX程序的启动运转的最简单剖析.至于各种特效,动画,以及3D等,以后再慢慢的去啃食,贪多嚼不烂. 新建一个FireMonkey的HD Desktop Application,IDE会自动建立一个工程,进入工程,可以发现FMX的程序

一个支持FMX.Win框架的托盘控件

不多说了 直接上代码........有任何问题请给我邮件.... // *************************************************************************** // // FMX.Win 平台下托盘 // // 版本: 1.0 // 作者: 堕落恶魔 // 修改日期: 2015-06-26 // QQ: 17948876 // E-mail: [email protected] // 博客: http://www.cnblogs.c

关于Delphi XE2的FMX的一点点研究之消息篇

Delphi XE2出来了一阵子了,里面比较抢眼的东西,除了VCLStyle这个换肤的东西之外,另外最让人眼亮的应该是FMX这个东西了.万一的博客上都连载了一票的关于FMX的使用心得了.我还是没咋去关注,因为技术这个东西,天天在变,跟着他跑,俺伤不起啊!直到今天,看了一下盒子,然后群中也有人说关于FMX在Windows下面如何来发送消息的问题,说发送不了.实际上,FMX这个东西是一套跨平台机制的GUI类库,消息这个东西只是Windows下面的,所以发送消息这个说法应该不算通用.不过加以研究应该可

应用程序的关闭退出(在FMX中,Activity替代了Form的概念)

在VCL中,关闭程序的主窗体也就意味着程序的主循环结束,主程序自然而然结束.所以在主窗体中使用窗体的关闭函数(Close)即可,如下: procedure TfrmMain.btncloseClick(Sender: TObject); begin   Close; end; 在FMX中,由Activity替代了Form的概念,虽然TForm类仍然存在,但MainForm通过关闭函数无法结束程序,使用Application.Terminate均无效,调整为: uses   FMX.Platfor

[FMX]在你的跨平台应用中使用剪贴板进行复制粘贴

[FMX]在你的跨平台应用中使用剪贴板进行复制粘贴 2017-08-10 ? Android.C++ Builder.Delphi.iOS.教程 ? 暂无评论 ? swish ?浏览 516 次 VCL 中如何使用剪贴板咱就不说了,FMX 做为一个新的框架,提供了跨平台的剪贴板支持.FMX 对剪贴板的支持来自两个接口: IFMXClipboardService:位于 FMX.Platform.pas 中 1 2 3 4 5 6 7 8 9 10 11 IFMXClipboardService =

Android实例-操作摄像头(XE8+小米2)

结果: 1.同样是照相,自己的程序设置为高质量时刷新慢,而小米手机的相机那真心反映快呀. 2.就算我设置为最高质量,可相片也没有小米手机的相片大.我最大是2000*1000,而小米可以做到3000*2000,如果有人问我为什么都是整数,我会K你的. 实例代码: 1 unit Unit1; 2 3 interface 4 5 uses 6 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,

Android实例-设置消息提醒(XE8+小米2)

结果: 1.二个按钮可以新建消息提醒,最小化也是新建消息提醒. 2.程序必须最小化后才能点击消息提醒Label2才会有反映. 实例代码: 1 unit Unit1; 2 3 interface 4 5 uses 6 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialog

Android实例-监测网络状态及一些事件(XE8+小米2)

1.网络连接:是指现在可不可以上网(你非要问我什么是网,我会K你呀的). 2.WIFI网络:是指现在可以上网,用的是不是WIFI网络(如果你打开了WIFI那它会显示正在使用WIFI). 3.移动网络:是指现在可以上网,用的是不是移动网络(如果你打开了移动的数据流量它会显示移动网络). 第三方单元: 1 unit Androidapi.JNI.Network; 2 3 interface 4 5 function IsConnected: Boolean; 6 7 function IsWiFiC

delphi xe10 手机程序事件服务操作、退出键操作

//程序事件服务操作 var FMXApplicationEventService: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService (IFMXApplicationEventService, IInterface(FMXApplicationEventService)) then FMXApplicationEventService.SetApplicationEve