AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Cross-Platform-Entwicklung iOS GUI abhänging vom Target auswählen
Thema durchsuchen
Ansicht
Themen-Optionen

GUI abhänging vom Target auswählen

Ein Thema von Crocotronic · begonnen am 9. Nov 2013 · letzter Beitrag vom 9. Nov 2013
 
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, 16: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 16:28 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:51 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz