Location enabling your C++Builder for iOS apps

Posted by on in Blogs
In this video I show you how to location enable your C++Builder for iOS applications using the TLocationSensor component.  I'll also show you how to use the resulting latitude and longitude coordinates to display a Google map using the TWebBrowser component. You'll start by creating a new C++Builder for iOS application and choose the blank application project template.

Next I'll add a TToolBar component with a TLabel, a TListBox component with 3 ListBoxItems, a TSwitch component, the TLocationSensor component and the TWebBrowser component.  After you've put the components togetner, your form will look something like the following in the IDE form designer:

Next I add an OnSwitch event handler for the TSwitch component.  I use the TSwitch to activate and deactivate the TLocationSensor component. Here is the OnSwitch event handler code:

    void __fastcall TForm1::Switch1Switch(TObject *Sender)
    LocationSensor1->Active = Switch1->IsChecked;

Next, I add code for the TLocationSensor's OnLocationChange event handler to get the previous and current location coordinates, display the latitude and longitude, and use the TWebBrowser's Navigate method to go to Google Maps and return the map showing the current location.  Here is the code for the OnLocationChange event handler:

    void __fastcall TForm1::LocationSensor1LocationChanged(TObject *Sender,
    const TLocationCoord2D &OldLocation,
    const TLocationCoord2D &NewLocation)
    ListBoxItem2->Text = ListBoxItem2->Text.sprintf(
    L"Latitude: %f",
    ListBoxItem3->Text = ListBoxItem3->Text.sprintf(
    L"Longitude: %f",

    String URLString = "";
    URLString = URLString.sprintf(
    NewLocation.Latitude, NewLocation.Longitude);


Compile and Run the application on your iOS device and you'll see the following output showing the Latitude, Longitude and the Google Map for your current location (I am currently in Houston for the RAD Studio XE5 lunch and learn tomorrow):

Watch me design, code, compile and run this application on my iPhone 4S in the YouTube at http://www.youtube.com/watch?v=U-sQeBTqaAI

For additional information about C++Builder for iOS go to the product information page - http://www.embarcadero.com/products/cbuilder/ios-development

Special Offer: Get a free C++Builder iOS upgrade when you buy qualifying C++Builder XE5 or RAD Studio XE5 tools

C++Builder for iOS is coming soon (expected December 2013). Very soon, you will be able to create iOS apps with C++Builder! Get started with the latest version of C++Builder or RAD Studio today to benefit from the fastest, visual, multi-device app development solution for Windows and OS X, and be one of the first to deliver C++Builder apps on iOS.

Watch the C++Builder for iOS Preview at http://www.youtube.com/watch?v=EwHJbB0Zi0g

Buy one of these qualifying tools now and get the C++Builder iOS upgrade FREE as soon as it is available:

  • C++Builder XE5 – Enterprise, Ultimate or Architect editions only

  • RAD Studio XE5 – all editions

This offer is not available for C++Builder Professional edition or Starter edition.

How to get it: Purchase one of the qualifying products, new user or upgrade. When C++Builder iOS support is released, you will gain access to iOS features in a free downloadable upgrade to your XE5 product.
Exceptions: Does not apply to C++Builder Professional or Starter edition.

Availability: Buy now. The iOS upgrade will be available to all C++Builder XE5 Ent/Ult/Arch registered users and all RAD Studio XE5 users. This offer can be combined with the "Upgrade from any earlier version", "Bonus Pack" and "Step Up to Ultimate" offers.

Gold User, Rank: 1, Points: 2466
David Intersimone (known to many as David I.) is a passionate and innovative software industry veteran-often referred to as a developer icon-who extols and educates the world on Embarcadero developer tools. He shares his visions as an active member of the industry speaking circuit and is tapped as an expert source by the media. He is a long-standing champion of architects, developers and database professionals and works to ensure that their needs are folded into Embarcadero's strategic product plans. David holds a bachelor's degree in computer science from California Polytechnic State University at San Luis Obispo, California.


  • Guest
    Stuart Kelly Monday, 16 December 2013

    Thanks for the fourth video, are any more coming soon?

  • Guest
    David Intersimone Wednesday, 1 January 2014

    Stuart - I will be working on more C++ for iOS videos this month. I just got too busy with some other work to end the year, but now have more time in January.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: