Jump to content
Sign in to follow this  
Silvio Torres

Delphi 10.4.2 doesn't select customized view in runtime

Recommended Posts

Hi, all...

 

I'm using a customized view for Android Phone Samsung A03, but it is not selected in runtime:

 

Through the use of functions to return the values of physical and logical pixels size of screen, I determined the values to be used in the specifications in DevicePresets.XML.

I created a package .BPL with TDeviceinfo.AddDevice method in a unit, instaled this package, in design time is showed correctly.

In the main form of the application, I added the unit in USES clause.

 

DevicePresets.XML:

    <MobileDevice>
        <Name>SA03</Name>
        <DevicePlatform Default="False">3</DevicePlatform>
        <Portrait Enabled="True" Width="360" Height="706" Top="22" Left="17" StatusbarHeight="0" StatusBarPos="0" Artwork="C:\Desenvolvimento\DelphiSA03.jpg" Mask=""/>
        <UpsideDown Enabled="False" Width="0" Height="0" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" Mask=""/>
        <LandscapeLeft Enabled="False" Width="0" Height="0" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" Mask=""/>
        <LandscapeRight Enabled="False" Width="0" Height="0" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" Mask=""/>
        <Displayname>Samsung A03</Displayname>
        <UserData>True</UserData>
        <FormFactor>2</FormFactor>
        <Thumbnail>C:\Users\Silvio\AppData\Roaming\Embarcadero\BDS\21.0\Thumbs\SA03</Thumbnail>
        <Default/>
        <Hidden/>
    </MobileDevice>

 

Unit in .BPL package:

 

unit SA03;

interface

implementation

uses

  system.Devices, system.Types, system.SysUtils;

const
  ViewName = 'SA03'; // The unique name of the view, it has to be the same name as the one written between <Name></Name> tags of the DevicePreset.xml file.

initialization

  TDeviceinfo.AddDevice(TDeviceinfo.TDeviceClass.Phone, ViewName,
    TSize.Create(706, 360), TSize.Create(706 div 2, 360 div 2), // MinPhysicalSize(max, min), MinLogicalSize(max, min)
    TSize.Create(1459, 720), TSize.Create(1459 div 2, 720 div 2), // MaxPhysicalSize(max,min), MaxLogicalSize(max,min)
    TOSVersion.TPlatform.pfAndroid, 269); //Select the platform and the pixel density.

finalization

  TDeviceinfo.RemoveDevice(ViewName); // To unregister the view after unistalling the package.

end.

 

I'm forgetting something?

 

Thanks in advance!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×