Category: Firemonkey

FMX MacOS64 button click not firing within printing loop

I'm sure this is simple but I've spent hours and am missing the solution. Working in Delphi FMX MacOS64. (This same structure works fine in Delphi VCL). I have a simple while loop that prints a multi-page report. When the report starts, I show a small "cancel printing" form that shows the page number being printed, and has a Tbutton marked "Cancel". I change the page number shown on the form each time through the loop (and that works fine). But the button won't respond unless I click it multiple times to get focus, and then multiple times again to get an actual click event to occur. I assume the OS has taken control and is not giving any cycles to check the button. How do I get around it? I've tried setting "repeat click" to true, and that seems to have an effect, but it is set to not repeat the first time until 1/2 second has passed, which is way too long to stop the printing, even if it works on the first repeat. Here's the code: Printer.BeginDoc; [do some stuff] iI:=1; labelcountI:=1; pageI:=1; while (iI<readfileSS.count) and (pageI<=ToPageI) do begin if readfileSS[iI]<>'' then begin [do some stuff] if isZebraB=false then begin if (labelcountI = 1) and (iI <> 1) and (pageI >= FromPageI + 1) then begin if cancelPrintB=true then endPrintB:=true; //cancelprintB is set to true in the click event if endprintB=false then begin printer.NewPage;; //cancelprint is the form; this line works if cancelprint.visible then begin cancelprint.Invalidate; cancelprint.CancelBtn.repaint; //have tried with and without this end else begin; end; application.processmessages; end else begin cancelprint.close; end; if (pageI >= FromPageI) and (endprintB=false) then begin [print a lot of stuff] end; end; end; inc (iI); end; Here's the code for the button. Pretty simple. procedure TCancelPrint.OKButtonClick(Sender: TObject); begin cancelPrintB:=true; hide; end; I have put a message in the OnClick code, and confirmed that it is not firing. As I said, this must be easy, but apparently not for me. Appreciate any help. Thanks. Scott
Read More

How can I read and set the paper style (aka papername) in Firemonkey MacOS

Working in Delphi Firemonkey for Mac OS64. Trying to read and then set the variable Apple calls the "paperName", which is the paper type (letter, legal, envelope, etc.) I know that it is accessed through NSPrinter.PaperName? but I do not understand how to code FMX to access it. I'm using cookbooked code to get the paper rectangle: FPrintInfo := TNSPrintInfo.Wrap(TNSPrintInfo.OCClass.sharedPrintInfo); FPrintInfo.retain; PMGetAdjustedPaperRect(FPrintInfo.PMPageFormat, @PaperRect); FPrintInfo.release; but I'm not experienced at all with Mac code so my attempts to plug-and-play off of this code to get papername have not been successful. Thanks for your help. Dave, Thanks. Sorry, I didn't really give you enough info. The code I provided does work, to get the paper rectangle. What I am trying to get, in addition, is the paper name, and I can't figure out what function will get me that. I'm trying to use PMGetPageFormatPaper(FPrintInfo.PMPageFormat, @PaperTypeS); but I think I may not be declaring PaperTypeS correctly. What I'm trying is: function getPaperShape: string; var FPrintInfo: NSPrintInfo; PaperRect: PMRect; paperwidth,paperheight:double; paperTypeS:string; begin FPrintInfo := TNSPrintInfo.Wrap(TNSPrintInfo.OCClass.sharedPrintInfo); FPrintInfo.retain; PMGetAdjustedPaperRect(FPrintInfo.PMPageFormat, @PaperRect); PMGetPageFormatPaper(FPrintInfo.PMPageFormat, @PaperTypeS); FPrintInfo.release; paperwidth:= PaperRect.right-PaperRect.left; paperheight:=; end; That clearly is not correct, since I get nothing returned in paperTypeS. I've tried declaring paperTypeS as NSPrinter.PaperName, or just as PaperName, or as PMPaperName, but clearly I'm just guessing here and none of those are recognized by FMX as valid types. Does that make more sense? Again, thanks. Scott
Read More

How to use for in with TTabControl in Delphi FMX?

Sorry if this is a duplicate question but I didn't find a solution anywhere. I want to make a for in to search for a specific tag on my many tabbed TTabControl component, but I have no clue on how to do this. My TTabControl named TabControl1 receives its tabitems during runtime by a query. It has to be designed to support from 1 to 100+ tabs if the client wants it. So each tab has a description which is its name and an index on my category table, each time I create a TTabItem, I assign it a tag which is the tab index on my sql table SQL:: DROP TABLE IF EXISTS Category; CREATE TABLE Category ( CAT_ID integer primary key , CAT_Descr Varchar(200) ); Delphi:: FDQ.Close; FDQ.Open('SELECT * FROM Category'); while not FDQ.Eof do begin TabControl1.Add().Tag := FDQ.FieldByName('CAT_ID').AsInteger; FDQ.Next; end; For my testing purposes I have 5 items on the database: ([1, tab1], [2, tab2], [3, tab3], [4, tab4], [5, tab5]) So when I run the code, it creates 5 tabs with a tag from 1 to 5 on them, great, the tag works. But now I need to populate these tabs with items made in runtime also from a query and now is the part where the for in will happen, but that's where I don't know how to make it loop properly on the tabs procedure TfListing.createtabs; var dummytoolbar: TToolBar; dummylabel: TLabel; dummylistbox: TListBox; tabitem: TTabItem; dummylistitem: TListBoxItem; begin // listboxitemlabel // listboxitemdetaillabel for DM.FDQ.FieldByName('CAT_ID').AsInteger in TabControl1.Tabs[].Tag do <<== this is the line with the issue begin try dummytoolbar := TToolBar.Create(tabitem); dummytoolbar.Parent := tabitem; dummytoolbar.Align := TAlignLayout.Top; dummylabel := TLabel.Create(dummytoolbar); dummylabel.Parent := dummytoolbar; dummylabel.Align := TAlignLayout.Contents; dummylabel.StyleLookup := 'toollabel'; dummylabel.Text := DM.FDQ.FieldByName('CAT_Descr').ToString; dummylabel.TextAlign := TTextAlign.Center; dummylistbox := TListBox.Create(tabitem); dummylistbox.Parent := tabitem; dummylistbox.Align := TAlignLayout.Client; dummylistitem := TListBoxItem.Create(dummylistbox); dummylistitem.Parent := dummylistbox; dummylistitem.Height := 44; dummylabel := TLabel.Create(dummylistitem); dummylabel.Parent := dummylistitem; dummylabel.Align := TAlignLayout.MostLeft; dummylabel.StyleLookup := 'listboxitemdetaillabel'; dummylabel.Text := dm.FDQ.FieldByName('PRO_Stock').AsString; dummylabel := TLabel.Create(dummylistitem); dummylabel.Parent := dummylistitem; dummylabel.Align := TAlignLayout.Client; dummylabel.StyleLookup := 'listboxitemlabel'; dummylabel.Text := dm.FDQ.FieldByName('PRO_Name').AsString; finally dummytoolbar.DisposeOf; dummylabel.DisposeOf; dummylistbox.DisposeOf; dummylistitem.DisposeOf; end; end; end; How can I make it work?
Read More

Never get lost again with TMS FNC Maps!


After all our experience with TMS FMX/VCL WebGMaps & WebOSMaps, and the latest and greatest technologies we’ve been working on in FNC & WEB, we thought by ourselves what would be the next logical step? We wanted to feel the power of dynamically switching between various mapping services on mobile. We wanted to have access to step-by-step directions in a browser. We wanted to have an out of the box, worry free experience to provide mapping, directions and geocoding in one big library/component set that works on 4 frameworks and a lot more operating systems.

We wanted to create a component where you are not tied to a fixed mapping service provider but make it as easy as changing a property to switch to another provider. When a provider raises prices, reduces functionality or when another provider starts providing better routing, change one property setting in your application and you are up & running with another mapping service provider.

Cross-framework, cross-platform, cross-service

Introducing for the first time ever: TMS FNC Maps! You all know how the saying goes:

“A picture says more than a thousand words”

And as a cherry on the cake, we’ve created a video that shows a quick overview of what TMS FNC Maps has to offer and which features are supported.

Supported services & features

Below is a list of features and services that TMS FNC Maps supports. As said in the video, with these features we aim for 1.0, but 1.0 is just the beginning, and many more features and map services will be added in the future. Please let us know if you have a service or feature of a specific service that you want to see available in TMS FNC Maps.

List of services for mapping, directions and geocoding

  • Google
  • Here
  • Microsoft Azure
  • Microsoft Bing
  • TomTom
  • MapBox
  • OpenLayers

List of features

  • Directions/Routing (TTMSFNCDirections)
  • Options for configuring alternative routes, step by step directions, …
  • Geocoding (normal, reverse) (TTMSFNCGeocoding)
  • Getting current location (TTMSFNCLocation)
  • Maps (TTMSFNCMaps)
    • Polylines
    • Polygons
    • Markers
    • Circles
    • Rectangles
    • Zooming, centering
    • Loading GPX, GeoJSON
    • Various Events
  • Google Maps (TTMSFNCGoogleMaps)
    • Inherits from TTMSFNCMaps
    • Load KML
    • Editing of polylines, polygons, circles and rectangles
    • Dragging of markers
    • Traffic
    • Themes (Night, …)


Please remember, TMS FNC Maps will be part of the FNC family and FNC is a cross-platform / cross-framework component library. Write your code once and target multiple operating systems!

Breaking changes!

To get the best out of TMS FNC Maps and make all of this work together we’ve introduced breaking changes and moved the TMSFNCCloudBase unit from TMS FNC Cloud Pack to TMS FNC Core. This means that each FNC product will have access to this unit and this allows you to consume your own REST service, download/upload files without the need for TMS FNC Cloud Pack.

Stay tuned!

More is coming in the next days, weeks and we are currently hard at work to make a 1.0 available as a BETA to all TMS ALL-ACCESS users, so stay tuned!, and again, feedback is highly appreciated so don’t hold back!

Read More

Read More

Mariscos – クールアプリセレクション

今日のクールアプリセレクションは、Daniel Rodríguez Hernández氏のMariscosです。Mariscosは、レストラン向け管理ツールで、スタッフとマネージャの双方が、注文、支払い、レシートの管理とトラッキングをサポートします。Delphiによって構築されており、Androidデバイスで利用できます。(read more)
Read More

How to read/send data to arduino over headphone jack with Firemonkey?

Is there any source (like document, code samples etc.) or component to read data sent by (and send data to) arduino via audio jack. There are some examples on here, here and here but I couldn't find how to read this data with Delphi (FireMonkey). Added After Codebreaker007's comment I'm trying to communicate Arduino Pro Mini with Android/iOS app (this is an iOT project) to let phone app send some command and device collect some data then send to the phone I don't need to connect my gadget to the PC (it is for just Mobile) serial over usb is not an option because some software/hardware requirements (sort OTG cable, USB Host settings, drivers etc..) so I just want to get data over 3.5mm TRS (3 pin - preferred) or TRRS(4pin) stereo jack. In addition, Arduino Pro Mini has no USB interface and I don't want to use USB to TTL Converter due to its size
Read More

Delphi Firemonkey Programmatic Data File Export to Excel — Where are the units and methods?

TeeChart can export data from the chart editor (tcharteditor). In VCL and (judging from documentation) .net, one can programmatically export using the chart1.export command. I am looking to do the same from TeeChart FireMonkey. What unit adds such a command? Shouldn't there be Chart1.Export?
Read More

Work@Home with Slack in the latest TMS FNC Cloud Pack update!

Stay Safe!

First of all, the TMS team wishes you a good health during these difficult times. Not only privately but also for the business you are running / working for. We at TMS are currently working from home and are doing our best to provide you with the highest care at software level and support that we can provide in the current circumstances. Even working at home doesn’t stop us from releasing new and exciting stuff!

Work @Home

With the latest release (v1.2.0.0) of the TMS FNC Cloud Pack we are introducing Slack. One of the most productive collaboration service out there and we have created a component for you that allows you to connect, share, update, upload and download content on the various channels under your work project. Below is a list of features the TTMSFNCCloudSlack component is supporting.

  • Retrieve all the users in your Slack team
  • Retrieve the information and profile for a specific Slack user
  • Download the profile picture of a user
  • Retrieve all conversations in your Slack team or get a specific type as public channels, direct messages, …
  • You can also get all the conversations that a specific user has access to

  • Retrieve the posted messages from a specific conversation
  • Retrieve the replies to a message.
  • Download the files that were posted in a message
  • Post your message in a conversation or a reply to a specific message
  • Upload a file to a specific conversation

TMS FNC Cloud Pack

The TMS FNC Cloud Pack was released in April, 2019 (, and has gotten a lot of improvements on the existing services. We have now added a new service (TTMSFNCCloudSlack) and are continuing our search for more services. If you have an idea for new services, suggestion for enhancing existing services or missing a service that is not yet implemented, please do not hesitate to ask us.

Please remember, TMS FNC Cloud Pack is part of the FNC family and FNC is a cross-platform / cross-framework component library. Write your code once and target multiple operating systems!

Read More

Read More

Audio playback rate on ios and firemonkey app

I'm looking for the way to change audio playback rate(playback speed) on iOS with firemonkey application. I found MPMediaPlayback interface and setCurrentPlaybackRate procedure in iOSapi.MediaPlayer unit in iOSapi.MediaPlayer.pas, but I couldn't figure out how to use this interface with TMediaPlayer component nor TMPMusicPlayerController class. Environment Windows 10 Home 1809 Delphi 10.3 Update3 26.0.36039.7899 MacBook Pro 13 inch early 2011 macOS Sierra 10.12.6
Read More