May 15th, 2013 by Anders Ohlsson
Posted in C++Builder, C++Builder XE3, C++Builder XE4, CodeRage, DataRage, Delphi, Delphi Prism, Delphi XE2, Delphi XE3, Delphi XE4, ERStudio, FireMonkey, RAD Studio, RAD Studio XE2, RAD Studio XE4, ednfront, iOS, iPhone | No Comments »
May 15th, 2013 by Anders Ohlsson
There’s currently an issue with TWebBrowser in that it doesn’t allow for zooming. Luckily it’s fairly easy to fix.
I suggest that you make a copy of FMX.WebBrowser.iOS.pas and put it in the same directory as your project. You then add it to your project. This way it will be picked up automagically.
Now for the hardest part…
Make the following change in FMX.WebBrowser.iOS.pas (your copy).
constructor TiOSWebBrowserService.Create;
begin
FWebView := TUIWebView.Create;
FWebView.setScalesPageToFit(true); // Add this line of code
FDelegate := TiOSWebViewDelegate.Create;
FDelegate.SetWebBrowser(Self);
FWebView.setDelegate(FDelegate.GetObjectID);
end;
Thanks Sarina for the tip!
Share This | Email this page to a friend
Posted in Delphi, Delphi XE4, FireMonkey, RAD Studio XE4, iOS, iPhone | 4 Comments »
May 2nd, 2013 by Anders Ohlsson
Luis Felipe González Torres (our MVP in Venezuela) published an example of a Delphi XE4 APN server and a Delphi XE4 APN client!!!
The source code is provided. The video is in Spanish, but Luis Felipe is paging through the source code in a very nice manner, so it’s easy to follow along.
Super cool, Luis Felipe!
Enjoy!
Share This | Email this page to a friend
Posted in Delphi, Delphi XE4, FireMonkey, RAD Studio XE4, iOS, iPhone | 7 Comments »
May 1st, 2013 by Anders Ohlsson
Consider this code. It works. And I was just about to answer a commenter with it… But my brain HURTS reading it, even more writing it, and much more recommending that someone else copies it…
function SharedApplication: UIApplication;
begin
Result := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
SharedApplication.openURL(TNSURL.Wrap(TNSURL.OCClass.URLWithString(NSSTR(PChar(String('http://www.embarcadero.com'))))));
end;
Luckily, David Clegg has blogged about his included sample code in XE4.
Version Two of the code looks like this:
uses
Apple.Utils;
procedure TForm2.Button1Click(Sender: TObject);
begin
SharedApplication.openURL(StringToNSURL('http://www.embarcadero.com'));
end;
But, Cleggy even has a helper for that, so here you go. Final implementation:
uses
Apple.Utils;
procedure TForm2.Button1Click(Sender: TObject);
begin
OpenURL('http://www.embarcadero.com');
end;
Share This | Email this page to a friend
Posted in Delphi, Delphi XE4, FireMonkey, RAD Studio XE4, iOS | 8 Comments »
May 1st, 2013 by Anders Ohlsson
One thing that I’ve wanted to try for quite a while is doing something when an app gets put in the background (user hits the home button for example). An example of this is a game that my kids play - when they leave the game, the character yells out something like "Don’t leave!", "Come back!", "Hope you enjoy your day without me!" and other random fun stuff.
Sometimes it also schedules a notification to fire at a later date. Let’s say the kids forget to play the game for a few days… All of a sudden out of nowhere the iPad will scream at you "Come back and play NOW! I’m bored!"
How is this done? Let’s not waste anymore time… Here is the complete form source code for the simplest case - scheduling a notification upon entering the background.
unit Unit1;
interface
uses
System.SysUtils, System.Classes, FMX.Forms, FMX.Platform;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function AppEvent(AAppEvent: TApplicationEvent; AContext: TObject) : Boolean;
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
FMX.Notification;
procedure SendNotification;
var
NotificationService: IFMXNotificationCenter;
Notification: TNotification;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXNotificationCenter) then
NotificationService := TPlatformServices.Current.GetPlatformService(IFMXNotificationCenter) as IFMXNotificationCenter;
if Assigned(NotificationService) then begin
Notification := TNotification.Create;
try
Notification.Name := 'MyLocalNotification';
Notification.AlertBody := 'Hello from the Delphi XE4 iOS app that you used 5 seconds ago!';
Notification.FireDate := Now + EncodeTime(0,0,5,0);
NotificationService.ScheduleNotification(Notification);
finally
Notification.Free;
end;
end
end;
function TForm1.AppEvent(AAppEvent: TApplicationEvent; AContext: TObject) : Boolean;
begin
if AAppEvent = TApplicationEvent.aeEnteredBackground then
SendNotification;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
AppEventSvc: IFMXApplicationEventService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(AppEventSvc)) then
AppEventSvc.SetApplicationEventHandler(AppEvent);
end;
end.
The main things that we do in this code are:
1. Hook up the Application Event Handler on OnCreate of our form
2. Schedule a notication if the event received is aeEnteredBackground
The rest is handled by iOS for us.
Special thanks to Darren Kosinski who shared one of his test examples on how to handle iOS application events!
Share This | Email this page to a friend
Posted in C++Builder, C++Builder XE3, CodeRage, Delphi, Delphi XE2, Delphi XE4, FireMonkey, RAD Studio, RAD Studio XE4, ednfront, iOS, iPhone | 2 Comments »
April 30th, 2013 by Anders Ohlsson
The following very short snippet shows you how to set/clear the network activity indicator on iOS.
uses
iOSapi.UIKit;
function SharedApplication: UIApplication;
begin
Result := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
SharedApplication.setNetworkActivityIndicatorVisible(not SharedApplication.isNetworkActivityIndicatorVisible);
end;
Share This | Email this page to a friend
Posted in Delphi XE4, FireMonkey, iOS | 5 Comments »
April 22nd, 2013 by Anders Ohlsson
Check out the trial here - http://www.embarcadero.com/products/rad-studio/downloads
Learn all about XE4 at the RAD Studio XE4 Launch Webinar - Wednesday, April 24
- 6:00AM PDT / 9:00AM EDT / 13:00 UTC
- 11:00AM PDT / 2:00PM EDT / 18:00 UTC
- 5:00PM PDT / 8:00PM EDT / 11:00AM 25-Apr Australia EDT
During the webinar you will learn:
- How multi-device app development with RAD Studio can expand the capabilities and efficiency of your development team
- How to use RAD Studio XE4 to create true native Delphi applications for iOS devices
- Accessing and integrating iOS sensors and services
- Working with local databases and enterprise data
- Pricing and availability of RAD Studio XE4
Register for the webinar at:
http://forms.embarcadero.com/forms/AMUSCA1304RADStudioLaunchWeb4-24
IBLite - embeddable SQL database for iOS
IBLite is a freely deployable, embeddable database for iOS that runs in a stand-alone environment and enables deployment of apps which directly utilize the InterBase engine. IBLite is available exclusively with RAD Studio XE4 (all editions) and Delphi XE4 (Professional with Mobile and above).
Start Building Now
Take the next step in the evolution of multi-device, true native code, on-device prototyping app development with RAD Studio XE4. Start building now.
Enjoy!
Share This | Email this page to a friend
Posted in C++Builder XE3, Delphi XE3, FireMonkey, RAD Studio XE3, iOS, iPhone | No Comments »
March 27th, 2013 by Anders Ohlsson
Get Delphi XE3 or RAD Studio XE3 today with the iOS Pre-Release Beta, and save 20% when purchased with 1-year Maintenance. Click here to buy from the Embarcadero store with the 20% discount or click below for other options. Offer available for ESD individual user licenses for Delphi XE3 Enterprise, RAD Studio XE3 Professional and RAD Studio XE3 Enterprise only.
What you get:
- XE3 Multi-Device development with Windows/Mac and 64-bit
- iOS Pre-release Beta to start learning mobile development today with Delphi (no AppStore deployment during beta)
- All updates and major releases over the next 12 months. See the 2013 Roadmap for what we have planned.

Share This | Email this page to a friend
Posted in C++Builder, C++Builder XE3, Delphi, Delphi XE2, Delphi XE3, FireMonkey, RAD Studio, RAD Studio XE2, RAD Studio XE3, ednfront, iOS, iPhone | 1 Comment »