Ver Mensaje Individual
  #2  
Antiguo 02-06-2017
jhonalone jhonalone is offline
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 547
Reputación: 17
jhonalone Va por buen camino
Hola a todos.

He resuelto esta cuestión de la siguiente manera.

1.- He colocado el TWebBrowser dentro de un TScrollBox. El TScrollBox alineado primero alClient o Client (Según versión de Rad Studio) para que me ocupe todo el espacio disponible en el dispositivo.

2.- He cambiado la alineación del TScrollBox alNone o None (Según) porque si no no me deja modificar el ancho y el alto.

3.- He puesto la alineación del TWebBrowser alClient o Client (Ya sabéis)

4.- En la unidad donde se muestra el TWebBrowser tengo el siguiente código:
Código Delphi [-]
uses
 FMX.DeviceInfo, System.UIConsts;


function W : integer;
var
 S:String;
 px : integer;
 I:integer;
begin
  S := DeviceInfo.diScreenLogic;
  px := S.IndexOf('x');
  Result:=S.Substring( 0, px-1).ToInteger; // Se ajusta muy bien a la pantalla
//  Result:=TDeviceDisplayMetrics.Default.LogicalScreenSize.Width; // No se ajusta a la pantalla
end;

function H : integer;
var
 S:String;
 px : integer;
 I:integer;
begin
  S := DeviceInfo.diScreenLogic;
  px := S.IndexOf('x');
  Result:=S.Substring(px+2, S.Length-px-2).ToInteger; // Se ajusta muy bien a la pantalla
//  Result:=TDeviceDisplayMetrics.Default.LogicalScreenSize.Height; // No se ajusta a la pantalla
end;

procedure TAyu.FormShow(Sender: TObject);
   // PONEMOS ESTO EN ONSHOW PORQUE EL PROYECTO ESTÁ EN LANDSCAPE
   // PARA QUE LA DETECCION DEL WIDTH Y EL HEIGHT SIEMPRE SEA LA CORRECTA

begin
 DeviceInfoByPlatform; //Recoge los valores en el record DeviceInfo
 ScrollBox1.Height := H;
 Scrollbox1.Width  := W;
 WebBrowser1.Navigate('file://'+TPath.Combine(TPath.GetDocumentsPath, 'ayuda.htm'));
end;

He intentado hacerlo (Como podéis ver) con las variables standard de Delphi (FMX.Types.TDeviceDisplayMetrics) pero no se ajusta bien a las distintas pantallas (¿?). Me hubiera gustado, pues me podría haber evitado bastantes "permissions" en mi App, pero funciona peor que con FMX.DeviceInfo. Ver descarga aquí.

DeviceInfo es un record declarado en la unidad FMX.DeviceInfo.pas descargable en el link anterior y que está definido de esta forma:
Código Delphi [-]
type
  TmyDeviceInfo = record
    diPlatform: string;
    diPlatformT: TOSVersion.TPlatform;
    diArchitecture: string;
    diArchitecture2: string;
    diArchitectureT: TOSVersion.TArchitecture;
    diMacAddress: string;
    diIPAddress: string;
    diPlatformVer: string;
    diDevice: string;
    diLang: string;
    diScreenPhis: string;
    diScreenLogic: string;
    diScreenWidth: Single;
    diScreenHeight: Single;
    diScale: Single;
    diMobileOperator: string;
    diTimeZone: integer;
    diIsIntel: Boolean;
  end;

var
  DeviceInfo: TmyDeviceInfo;

Algunos de los campos de DeviceInfo son bastante interesantes.

Bueno, si alguien conoce una manera mejor de resolverlo, estoy abierto a sugerencias, mientras tanto me quedaré con esto.

Lo cuento por si le sirve a alguien en el futuro.

Saludos.
__________________
"Pedid y se os dará; buscad y hallaréis ..." (Lc 11,9-10)
"...si no tengo caridad, nada soy..." (1 Cor 13,1-13)
Responder Con Cita