Registriert seit: 31. Dez 2004
Ort: Stuttgart
4.408 Beiträge
Delphi XE8 Enterprise
|
AW: GUI abhänging vom Target auswählen
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.
Geändert von RWarnecke ( 9. Nov 2013 um 17:28 Uhr)
|
|
Zitat
|