Einzelnen Beitrag anzeigen

Benutzerbild von RWarnecke
RWarnecke

Registriert seit: 31. Dez 2004
Ort: Stuttgart
4.408 Beiträge
 
Delphi XE8 Enterprise
 
#3

AW: GUI abhänging vom Target auswählen

  Alt 9. Nov 2013, 17:23
Ich habe das für eine Anwendung so gelöst :
Delphi-Quellcode:
program TestDemo;

uses
  System.StartUpCopy,
  FMX.Forms,
  {$IFDEF IOS}
  iOSapi.UIKit,
  {$ENDIF }
  {$IFDEF ANDROID}
  FMX.Platform.Android,
  Androidapi.JNI.GraphicsContentViewText,
  {$ENDIF }
  PadForm in 'PadForm.pas{PadMainForm},
  PhoneForm in 'PhoneForm.pas{PhoneMainForm},
  CommonHelperUnit in 'units\CommonHelperUnit.pas';

{$R *.res}

////////////////////////////////////////////////////////////////////////////////
///
/// To check if the app is running on an iPad
///
{$IFDEF IOS}
function IsPad: Boolean;
begin
  Result := TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).userInterfaceIdiom = UIUserInterfaceIdiomPad;
end;
{$ENDIF}
{$IFDEF ANDROID}
function IsPad: Boolean;
begin
  Result := (MainActivity.getResources.getConfiguration.screenLayout and TJConfiguration.JavaClass.SCREENLAYOUT_SIZE_MASK)
    >= TJConfiguration.JavaClass.SCREENLAYOUT_SIZE_LARGE;
end;
{$ENDIF}
////////////////////////////////////////////////////////////////////////////////
///
/// Main Program
///
begin
  Application.Initialize;
  Application.FormFactor.Orientations := [TFormOrientation.soPortrait, TFormOrientation.soInvertedPortrait, TFormOrientation.soLandscape, TFormOrientation.soInvertedLandscape];
  if IsPad then
    Application.CreateForm(TPadMainForm, PadMainForm)
  else
    Application.CreateForm(TPhoneMainForm, PhoneMainForm);
  Application.Run;
end.
Rolf Warnecke
App4Mission

Geändert von RWarnecke ( 9. Nov 2013 um 17:28 Uhr)
  Mit Zitat antworten Zitat