Jump to content

at3s

Members
  • Content Count

    68
  • Joined

  • Last visited

Posts posted by at3s


  1. I'm trying to use some custom button's style looks like in screenshot.

    There is just added TRectangle (in blue) in back of other controls.

    But this stopped button pressing event hiring - when press on button, it does nothing.

    Where is my bad?

     

    image.thumb.png.789cbc68b3286e9f5525d457adc67426.png


  2. 11 hours ago, Rollo62 said:

    Yes, the location is called asynchronously.

     

    I also would not stress the system directly in FormCreate, with the activation of Location, where it is still loading and initializating.
    Better to do that at a later time, maybe FormShow, or even better, manually controlled on demand by your own code only.

     

    I'm not sure if you asked for PermissionRequest correctly, because I cannot see something similar like this in your code.

    The result should be in mainUI thread, but to ensure that this is true you can use ForceQueue, to protect this against mysterious situations.

    I know that Android systems might forgive many of such issues in debug mode, but clearly is at high risk to fail in release and PlayStore.

    
    procedure Tfrm.FormShow(Sender: TObject);
    begin
        DoLocationActivate;
    end;
    
    procedure Tfrm.DoLocationActivate;
    begin
        TPermissionsService.DefaultService.RequestPermissions(
            [LPermissionLocationF, LPermissionLocationC]
            // PermissionResult
          , procedure ( const APermissions: TClassicStringDynArray;  const AGrantResults: TClassicPermissionStatusDynArray )
            begin
                if      (     ( Length( AGrantResults )  <> 2                           )
                          or (        ( AGrantResults[0] <> TPermissionStatus.Granted ) ) 
                          or (        ( AGrantResults[1] <> TPermissionStatus.Granted ) ) 
                        ) then
                begin
                    exit;  //user doesnt grant access
                end;
    
                TThread.ForceQueue(   // this should not be necessary, but just to ensure that Active := True is really called in the main thread only
                    procedure
                    begin
                        LocationSensor.Active := True;
                    end );
            
            end );
    end;

     

    Yes, there is PermissionRequest in the code, but I did not provide it here.

    It executes before a screen showing.

     

    Your code works fine and it's more elegant and correct than my trick with the OnLocationChanged event, thanks for an answer.


  3. I have a screen with the: 

    LocationSensor: TLocationSensor;

    And code:

    procedure Tfrm.FormCreate(Sender: TObject);
    begin
      LocationSensor.Active := True;
    end;
    
    procedure Tfrm.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      LocationSensor.Active := False;
      Action := TCloseAction.caFree;
    end;
    
    procedure ShowLocation();
    var
      mapPosition: TMapCoordinate;
    begin
      frm := Tfrm.Create(Application);
      try
        mapPosition := TMapCoordinate.Create(frm.LocationSensor.Sensor.Latitude, frm.LocationSensor.Sensor.Longitude);
    
        ShowMessage(FloatToStr(frm.LocationSensor.Sensor.Latitude) + ' | ' + FloatToStr(frm.LocationSensor.Sensor.Longitude));
      finally
        frm.Show;
        frm.BringToFront;
      end;
    end;

    When I call ShowLocation(); in Android 12, it returns 'NaN | NaN' first time, after that each calling returns correct coordinates.

     

    Is it a known issue or did I miss something?


  4. 22 minutes ago, Dalija Prasnikar said:

    iOS does not support terminating application, so Delphi does not have that support either.  If Delphi previously implemented Terminate on iOS it was most likely removed as such functionality would cause rejection on the AppStore. See https://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application

    Yup, I already found the source where it raises.

    So how close\hide iOS application using Delphi?

    I'm new with it.

    image.thumb.png.2f2f706b6df8f3c14026e177c15f6773.png


  5. I'm using libssl.so v 1.0.2r in my project and there was not a problem with the Android migration from Delphi 10.4 to 11.2.

    Sure, there are files for Android32 and Android64.


  6. On 2/23/2023 at 2:23 PM, Patrick PREMARTIN said:

    You have a solution, even if you don't have or want to buy a M1/M2 Mac today: you can rent one for few a days at a low cost.

     

    Try https://www.scaleway.com/en/hello-m1/

     

    They rent real Mac mini M1 hosted in a datacenter in Paris (France). You only have to install the softwares you need : Xcode and PAServer.

     

    You have a replay of my webinar (FR) at https://serialstreameur.fr/webinaire-20210304.php with links to written explanations (to translate in your language).

    Unfortunately I got the same error when was trying to build an iOS application on "Apple M1" chip\processor.

    What is wrong with this?

     

    I noticed, when I run a Windows version of this application built in Delphi 11, it required midas.dll.

    It was not when an app was build in Delphi 10.4.

    iOS fault on libmidas.a.

    [DCC Error] E2597 ld: in c:\program files (x86)\embarcadero\studio\22.0\lib\iOSSimARM64\Release\libmidas.a(C:\Projects\Olympus\tp\intermediate\release\lib\midas\iosdevice64\alchemy.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

    Just a notice.


  7. 1 hour ago, Patrick PREMARTIN said:

    Hi

    Has your Mac a M1/M2 processor or an "old" Intel model ?

    Unfortunately it's an Intel - 2.3GHz Dual-Core Intel Core i5.

     

    1 hour ago, beytullah said:

    Do you run successfully on IOS Device? (Not Simulator)

     

    I were working an project 7 years ago. One library not worked on IOS Simulator and not build project. But I runned on IOS device. The project built successfully. 

     

    You should try run your project on IOS Device.

    Yes, the project built (but not ran) fine on "iOS Device 64-bit" platform.

    The issue is - I've not connected an iPhone.

    Because it's my first iOS project and even was not sure I'll be able to finish it for iOS platform.

    So I was thought a simulator shall be enough.

     


  8. image.thumb.png.4a68573248dfb58751b4986419119d9c.png

     

    I'm trying to build my FMX iOS application.

    When I've selected iPhone, the project built fine.

    I'm not able to debug an application, because I do not have iPhone attached to my Mac machine.

     

    But an error has been occurred when I've selected simulator (see a screen shot):

    [DCC Error] E2597 ld: in c:\program files (x86)\embarcadero\studio\22.0\lib\iOSSimARM64\Release\libmidas.a(C:\Projects\Olympus\tp\intermediate\release\lib\midas\iosdevice64\alchemy.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

    Any idea how to fix this?

     


  9. I have a FireMonkey application which works fine in an Android.

    Now I want to build it in iOS.

    But the problem is, I did never it before.

    Can someone explain what exactly I have to do?

    F.e. Mac ot not, if 'yes' - what configuration, OS, iPhone or enough is simulator etc?

    Simple things for someone with the skills...


  10. 7 hours ago, Cristian Peța said:

    If you don't have the documentation then at least follow what that article says clearly: " This is because low-level programmers, such as those who designed the ESC/POS language, tend to blur the lines between data types: it’s all bytes at the end of the day."

    You need to write binary data. Simply don't put binary data in String and convert using TEncoding.ASCII.GetBytes().

     

    This won't help you. But if you want to know I used TBytes.

    As you can see in my sample, I don't send a string to the POS printer but rather TBytes.

    Probably a string type of AValue parameter of SendString procedure twice confusing you.

    Sure, it AValue is not properly populated, SendString procedure shall send something weird.

    But I got an image as output on printer, but it's just cutting by horizontal lines.

    And this Lazarus implementation of Nicholas Piasecki's code doesn't work for me as well.


  11. 14 hours ago, David Heffernan said:

    Do you have a specification for what these s printer expects to receive? 

    I used a lot of specification for ESC\POS printer.

    Actually I tried to make my code working in RawBT application (something like virtual ESC\POS printer) and now I'm trying to use GOOJPRT PT-210 device.

    I did not find a specification for this model of printer.

     

    but I require more general solution to be able to print a receipt from my Android application.

×