在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//程序事件服务操作 var FMXApplicationEventService: IFMXApplicationEventService; begin if TPlatformServices.Current.SupportsPlatformService (IFMXApplicationEventService, IInterface(FMXApplicationEventService)) then FMXApplicationEventService.SetApplicationEventHandler(HandleAppEvent) else flag := false; end; function TForm1.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject) : boolean; begin if flag = false then exit; case AAppEvent of TApplicationEvent.aeEnteredBackground: begin //当程序后台运行了 end; end; Result := true; end;
//退出键操作 procedure TPForm.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); begin if Key = vkHardwareBack then begin {$IFDEF ANDROID} MessageDlg('确认退出吗?', System.UITypes.TMsgDlgType.mtInformation, [ System.UITypes.TMsgDlgBtn.mbYes, //System.UITypes.TMsgDlgBtn.mbNo, System.UITypes.TMsgDlgBtn.mbCancel ], 0, System.UITypes.TMsgDlgBtn.mbCancel, procedure(const AResult: TModalResult) begin if AResult = mrYES then MainActivity.finish; { 退出程序 } // use FMX.Platform.Android end); {$ENDIF ANDROID} //close; Key := 0; exit; end; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论