Jump to content

jiyiwan

Members
  • Content Count

    4
  • Joined

  • Last visited

Posts posted by jiyiwan


  1. I'm writing an Android app in delphi 10.4.2 and when I write the scaling code in the OnGesture event of the image1 control, the IDE says "uncleared identifier" for the ScaleFactor. I've looked at it repeatedly, but I don't know where the problem is coming from, so I'm looking for help.
    Here is my code:

    unit Unit1;

    interface

    uses
      System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
      FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
      FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.Layouts,
      FMX.ExtCtrls,
      FMX.Gestures,
      FMX.Edit,
      System.IOUtils;
    type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        ImageViewer1: TImageViewer;
        Image1: TImage;
        GestureManager1: TGestureManager;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure ImageViewer1Gesture(Sender: TObject;
          const EventInfo: TGestureEventInfo; var Handled: Boolean);
        procedure Image1Gesture(Sender: TObject; const EventInfo: TGestureEventInfo;
          var Handled: Boolean);
      private
        { Private declarations }
         FLastDistance: Integer; 
         const MIN_DIM = 100; 
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;
      G_lujing:string='';
      G_myDir:string='MyBrain';
    implementation

    {$R *.fmx}
    {$R *.LgXhdpiTb.fmx ANDROID}
    {$R *.SmXhdpiPh.fmx ANDROID}
    {$R *.iPhone55in.fmx IOS}

    procedure TForm1.FormCreate(Sender: TObject);
    var path: string; fileName:string;
    begin
      path:=TPath.GetSharedDownloadsPath;
      path := TPath.GetDirectoryName(path);
      G_lujing:=TPath.Combine(path, G_myDir);
      try
        if not TDirectory.Exists(G_lujing) then  TDirectory.CreateDirectory(G_lujing);
        fileName := TPath.Combine(G_lujing, 'test.txt');
        if not FileExists(fileName) then TFile.WriteAllText(fileName, 'Hello world!');
      except on
        E: Exception do ShowMessage('An error occurred while creating the directory:' + E.Message);
      end;
    end;

    procedure TForm1.Image1Gesture(Sender: TObject;
      const EventInfo: TGestureEventInfo; var Handled: Boolean);
    begin
      if EventInfo.GestureID = igiZoom then
      begin
        // Zoom the image using ScaleFactor
        Image1.Scale.X := Image1.Scale.X * EventInfo.ScaleFactor;
        Image1.Scale.Y := Image1.Scale.Y * EventInfo.ScaleFactor;
        // Adjust the image position based on the gesture focus point
        Image1.Position.Point := EventInfo.FocusPoint;
      end;
    end;


    end.

     


  2. 20 minutes ago, Dave Nottage said:

    You cannot deploy a file using Deployment Manager to a folder outside of the application. It might help to know why you actually want to, as there are issues inherent with dealing with "public" folders, especially on later versions of Android. 

    Here's what I was thinking: if the apk installer could deploy the local documentation to a public directory, it would make it easier for me to manually modify them later in the phone.


  3. I am developing an Android app and I want to deploy a local file to the public directory of my phone. I have done the following and tried many times, but I am unable to deploy the file to my phone. What is the problem? Could any of you help me?
    1. Select the compilation configuration and target platform: select "Debug configration - Android 64-bit platform" in Project > Deployment
    2、Add the line for deploying images: In project>Demplyment, click the "add files" button, the parameters are as follows
    local path=mypic\ 
    Local Name=pic.jpg
    Type=File
    remote path={sdcard}\Download\MyBrain\mypic\   
    remote name=pic.jpg
    I don't feel like there's anything wrong with it, but I just can't deploy this image to my phone. What is the problem?
     

    微信截图_20230602104107.png

×