Category: Firemonkey

Start touch and finish touch event Delphi

I implement simple painting application in Delphi FMX for Windows pc with touch screen. I am looking for a function which is invoked directly after the first touch on the screen and similar function invoked after finishing the touch. Very close to MouseDown and MouseUp and using TControl.Pressed. I tried to use mouse functions but unfortunately, many windows touch screens do not send this event after touching the screen (some of them do). I also tried Tap function but it is called only if you do not drag a finger over the screen. Finally, I wanted to use TGestureManager but it seems to focus on just Gestures like zoom, rotate, etc. Is there any other option to achieve my goal?
Read More

Is it better to do if assigned(MyObj) then or if (MyObj <> nil) then [duplicate]

This question already has an answer here: Best way to check if a Variable is nil? 2 answers When i read the modifications made in the original delphi source code (mostly in the firemonkey) I saw that embarcadero sometime replace if assigned(MyObj) then by if (MyObj <> nil) then. Is their any real reason to do this or it's simply purely cosmetic ?
Read More

Delphi – Using TEdit.tagObject to point to another object

I am using a descendant of TEdit and using TagObject to store an object. I'm using Firemonkey. In short, I am working with another object and want to assign a property of that object to my TMyEdit, so that whenever I load the object, the text gets updated, and when I change the text, the object gets updated. So I do it like this: Edit1 : TMyEdit; MyElement:TMyProperty; ... Edit1.TagObject:=TMyTextProperty(MyElement); (The typecast is necessary for other reasons. I mention it just in case it is related). The code works when MyElement is not nil to start with. If MyElement was nil, MyEdit automatically creates a new instance of TMyTextProperty and assigns it to tagObject. procedure TMyEdit.MyOnChange(Sender : TObject); begin if tagObject=nil then TagObject:=TMyTextProperty.Create(''); TMyTextProperty(TagObject).value:=text; end; I assume that since tagObject is a pointer and i pointed it to MyElement, then myElement would also be updated. But it isn't. Edit1.TagObject contains my value, but MyElement is stil nil. I need MyElement to be the newly created object. What am I doing wrong? How can I make sure that whenever the TagObject gets created, the MyElement points to the new object? Many thanks
Read More

Performance of HTTP POSTS from Firemonkey Android app has suddenly collapsed when on mobile data

A Delphi 10.2.3 Firemonkey app on Android I've had this app running and in use for about 6 months, and it's been fine. I recompiled the code after Windows Spring Update (I don't know if this is related), and the performance of HTTP POSTS has dramatically slowed e.g. a 49 byte response (to a simple request) is taking over 10 seconds whereas on wifi it's about 0.1 seconds. It's not the server side, in the sense that the connection is very brief, as one would expect. To do the connection, I'm using idHTTP, which has always worked fine. No code changed, I've tried a number of different networks, good signal and bad (it makes no real difference). Checked all the usual things, connections closing, things are freed as they should be, etc. Any ideas? Is there some parameter I should look at? (Edit) * Just to add, any test app that only does this sort of connection has the same problem. 0.1 seconds on wifi, 16 seconds in mobile data. * I realised I hadn't checked a GET - they work fine, nice 0.1 sec response to the same request, but run as a get. So it looks like there's something weird about the POST. (Edit) Completed a fresh Windows & Delphi install, and tested using a small android app that with 2 buttons, Get & Post, calling web services that simply return the parameters. No change. POST takes 10-ish seconds, GET takes about 0.1. Any ideas would be very helpful.
Read More

Delphi 10.2.3 RAD Server Linux Apache Patch Released

As you have probably seen, Embarcadero has released a few patches for 10.2.3. I wrote about them at http://blog.marcocantu.com/blog/2018-april-10-2-3-patches-recap.html and there was a new one for iOS covered by Sarina at https://community.embarcadero.com/blogs/entry/rad-studio-10-2-3-ios-11-3-patch-available. Yesterday, the compony released a patch that addresses a few critical issues when deploying RAD Server modules to Apache on Linux. The reported bug mentioned is not the key one, as the main issue was found and reported internally and not on Quality Portal. If you have any interest in deploying a RAD Server solution to Linux, this patch is a must have.  The download is at  https://cc.embarcadero.com/item/30836 . Just in case you missed is, remember that part of a RAD Studio. Delphi, or C++Builder Enterprise or Architect product, you now have the license to deploy a single RAD server instance without any further cost.
Read More

Linux Mint 18 and UEFI boot manager

Recently I was installing Linux Mint on a new Acer laptop with UEFI boot manager. The laptop came with preinstalled “Endless OS” which turned out to be useless because of absence of a package manager. I’ve created Linux Mint 18.3 bootable USB using Rufus, and chosen “GPT partition scheme for UEFI”. I did not make any BIOS changes before installation, and the installation procedure worked fine; I’ve chosen “Erase the entire disk” option during installation. After the installation, when I tried to launch the newly installed OS, I’ve got “No Bootable Device” screen. After several “try and error” iterations I came with the following solution: During installation, do not check “Install 3rd party drivers …” option – the drivers will not be installed anyway; they can be installed later using Driver Manager. After the installation is over, boot into BIOS settings (on Acer laptops by pressing F2 key after switching power on) and set the EFI file created during installation as trusted. The procedure is written in much detail here, only in my case the file turned out to be grubx64.efi The system should boot now, but without some drivers. The worst thing in my case appeared after installing Oracle’s Virtual Box – Virtual Box installs it’s own kernel driver, and Virtual Box did not work because the driver did not work. So you need to enable driver installation now, and it is done by disabling “Secure Boot” option in BIOS.
Read More

Crossplatform audio support in Delphi

I'm running Delphi Tokyo and I'm looking for a way to play audio on Windows and Android (and maybe at some point iOS). On Windows I can do with something like PlaySound(PChar(ResourceName), 0, SND_RESOURCE or SND_ASYNC), but I'm stuck on Android. I've tried TMediaPlayer, but it takes about a second before it starts playing, which is too long for a mouse click or screen tap. Basically I've built a Minesweeper clone and I'm looking for sound support (if you want to know the background). Suggestions?
Read More

DeviceCheck for iOS in FMX

Starting at iOS 11 Apple now has a means of letting us identify devices that have used something up (e.g. a trial period etc.) without identifying any personally identifying information: https://developer.apple.com/documentation/devicecheck The above link describes these DeviceCheck APIs. How can we do this in an FMX app? Will also need for Android eventually too. My intent is to let users vote from the app - but only vote once. thanks, russ
Read More

secure remote MySQL access with firemonkey

I've built an app that can download SQLite data via http it C++ Builder. I want to now allow users to give feedback that will get pushed into a remote database without traversing internet unencrypted. The database can be a MySQL that can live on a Synology NAS (although I don't mind using any other approach that might be easier - even pay if not too expensive) at a static IP address on the internet. Very low data payload required. I want to do this in C++ in Rad Studio in a Firemonkey app. I'm a novice (my day job is engineer) and this is just for my enjoyment. How can I make a secure connection from my FMX app (iOS and/or Android) to the remote database using the FireDAC components or Indy. My head is swimming from all the information out there that is above my head. thanks, russ
Read More

C++ Builder Tokyo 10.2.3 FMX Android application crash if I dont click on Next button on virtual keyboard

I use C++ Builder Tokyo 10.2.3 and trying to do something very simple on Android like typing some text into an Edit box. If I press Next or Done key on virtual keyboard everything is fine. If I press an Exit Button to go back the previous form it looks it is fine but then if I press Android Back button application crash. It took me hours to identify the problem but couldn't find any solution but trying to disable all other objects when user clicks in an Edit box and enable them if user click on Next.. It seems to me a bug but need to make sure before report it to Embarcadero. Thanks
Read More

May 25 is TMS XData training day, the day after TMS RADical Web Day

Our TMS XData expert Wagner R. Landgraf travels from Brasil to Germany especially for the TMS RADical Web training day on May 24th at Marienfeld, Germany. TMS XData is the tool for Delphi developers to enable creating fast, easy and secure REST APIs to access cloud databases from desktop, mobile and web client applications. As there is a demand for in-depth training on this powerful TMS XData product, we decided to also offer a possibility for training on TMS XData on May 25th, the day after the TMS RADical Web training day and available for an ultra limited number of developers to ensure a personal, hands-on and very interactive training. TMS XData Training Day (all sessions in English) 09h00 - 09h30 Welcome, coffee, meeting 09h30 - 10h30 1. Introduction to TMS Sparkle and TMS XData a) Presenting TMS Sparkle concepts: http.sys, modules, example server b) Creating a XData module with a “hello world” operation c) XData overal concepts: service operations and entities 10h30 - 11h00 Coffee break / Instructor available for questions and discussion 11h00 - 12h00 2. Service Operations a) Creating service operations - interface and implementation b) Parameter passing: in body, in url c) Supported parameter types: scalar, structured and PODO d) Parameter by reference e) Memory Management f) Using/receiving TStream 12h00 - 13h30 3-course warm lunch / instructor available for questions and discussion 13h30 - 15h00 3. Database access a) “Traditional” approach b) Connection Pool c) Aurelius integration in service operations d) Entity publishing: CRUD operations e) Querying, paging and counting entities f) Entity set permissions 15h00 - 15h30 Coffee break / Instructor available for questions and discussion 15h30 - 16h15 4. Desktop client-side development a) TXDataClient overview b) Invoking service operations c) CRUD operations from client d) Memory management 16h15 - 17h00 5. Web client-side development a) TXDataWebClient overview b) TXDataWebDataset usage c) Asynchronous paradigm 17h00 - 17h30 Closing, questions and answers. Alternative advanced topics that can be handled on-demand: a) JWT and authentication b) Server-side events c) Custom error-handling in server d) Swagger/OpenAPI The TMS XData training day price is 295EUR. For Delphi developers attending both the TMS RADical WEB training day and TMS XData training day, price is 395EUR. Contact us directly by email sales@tmssoftware.com for registrations. Contact us as quickly as possible as registration is on a first-come, first-serve basis.
Read More