Einzelnen Beitrag anzeigen

Rollo62

Registriert seit: 15. Mär 2007
4.093 Beiträge
 
Delphi 12 Athens
 
#6

AW: [Fmx] App crasht OnScreenRotation

  Alt 18. Feb 2016, 14:04
Also ich habe mittlerweile das Demo immer weiter abgespeckt:
- TabControls raus - crash
- Panels raus - crash
- Stylebook raus - crash
- DataModule raus - crash
- alle uses die unbenutzt sind raus -crash

Natürlich immer alle DCUs etc gelöcht, das ganze Android Verzeichnis - crash

Das macht mir langsam Angst
Ich habe jetzt nur noch die Form it einem Memo das die AppEvents und ScreenOrientation zeigt - crash

Hab die abgespeckte Demo nochmal im Anhang T81_....

Delphi-Quellcode:
unit UMain_Frm;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes
  , FMX.Forms
// , System.Variants
// FMX.Types, FMX.Controls, FMX.Forms, FMX.StdCtrls,
// FMX.Layouts, FMX.Objects, FMX.ImgList,
// FMX.Controls.Presentation
  , FMX.Platform
// , FMX.ScrollBox
  , FMX.Memo
  , System.Messaging, FMX.Types, FMX.Controls, FMX.Controls.Presentation,
  FMX.ScrollBox
  ;

type
  TMain_Frm = class(TForm)
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    FOrientationChangedId: Integer;
    { Private declarations }

    procedure EvOnOrientationChanged(const Sender: TObject; const Msg: TMessage);
    function EvOnAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;

    procedure Log(const ALog : String);

  public
    { Public declarations }
  end;

var
  Main_Frm: TMain_Frm;

implementation

{$R *.fmx}

procedure TMain_Frm.FormCreate(Sender: TObject);
var
  aFMXApplicationEventService: IFMXApplicationEventService;
begin

  if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(aFMXApplicationEventService)) then
    aFMXApplicationEventService.SetApplicationEventHandler(EvOnAppEvent)
  else
    Log('Application Event Service is not supported.');


  //Subscribe to orientation change events in OnCreate or similar
  FOrientationChangedId := TMessageManager.DefaultManager.SubscribeToMessage(
       TOrientationChangedMessage, EvOnOrientationChanged);


end;





procedure TMain_Frm.FormDestroy(Sender: TObject);
begin
  //Unsubscribe from orientation change events in OnDestroy or similar
  TMessageManager.DefaultManager.Unsubscribe(TOrientationChangedMessage, FOrientationChangedId);
end;

procedure TMain_Frm.Log(const ALog: String);
begin
  Memo1.Lines.Insert(0, ALog);

end;


procedure TMain_Frm.EvOnOrientationChanged(const Sender: TObject; const Msg: TMessage);
begin
  Log('Orientation changed: ' + Msg.ToString);
end;


function TMain_Frm.EvOnAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
begin

  case AAppEvent of
    TApplicationEvent.FinishedLaunching: Log('Finished Launching');
    TApplicationEvent.BecameActive: Log('Became Active');
    TApplicationEvent.WillBecomeInactive: Log('Will Become Inactive');
    TApplicationEvent.EnteredBackground: Log('Entered Background');
    TApplicationEvent.WillBecomeForeground: Log('Will Become Foreground');
    TApplicationEvent.WillTerminate: Log('Will Terminate');
    TApplicationEvent.LowMemory: Log('AppEvent: Low Memory');
    TApplicationEvent.TimeChange: Log('AppEvent: Time Change');
    TApplicationEvent.OpenURL: Log('AppEvent: Open URL');
    else
                                            Log('AppEvent: Unknown');
  end;
  Result := True;
end;

end.
Angehängte Dateien
Dateityp: zip T81_ScreenOrientCrash.zip (356,2 KB, 3x aufgerufen)
  Mit Zitat antworten Zitat