Best delphi-xe2 questions in September 2011

Where are the standard looking iOS controls\styles in Delphi XE2?

12 votes

We are currently in the process of evaluating Delphi XE2, and as you would expect I've started with FireMonkey as OS X and iOS development is of great interest. I've seen a couple of walkthrough's where people have created iOS apps using XE2 and I've managed to do the same, however the bread and butter of 'business applications' on an iPhone (which is how iOS support is being marketed) are buttons, lists, grids and connectivity (REST?).

Anyway, once you've created your iOS HD project the TButton initially looks green, whereas the TSpeedButton and TToolbar looks exactly like it should (blue gradient). The TToolbar doesnt have any way of adding buttons, presumably this is just a Panel, then?

Has anyone created styles for FM iOS HD apps, or do any of the wrappers allow direct creation of the standard iPhone controls?

I apologise if that sounds a little backwards given that I am attempting to evaluate using the trial version (which among other things doesnt provide the source, for obvious reasons!).

Thanks,

Ross

FireMonkey does not have standard iOS or OS X components. It draws all the components on its own, using a complicated set of layered sub-components, which are all editable with the FMX style editor in the IDE (or with a text editor outside the IDE).

So you can mimic the iOS or OS X components with the styles you get with the product or with your own custom styles. But to use the original UIKit/Cocoa Touch components, you'll have to use the FreePascal translations and conversions of the original Apple headers, and not FMX.

There is no designer for such UIs, unless you want to use Xcode 4.x. I don't know if FreePascal can load and use .xib files, though (although, why not? Probably just not automatically). You can, of course, create and place such components in code, at runtime.

So you either:

  • use FMX and design your own styles or modify the existing styles to your need, or
  • use Xcode and .xib files. Not sure how to do that with FreePascal.

FWIW, you can place any FMX component on any other FMX component (e.g. also a textbox on a button on an arcdial on a list item in a listbox), so it should be possible to place buttons on a toolbar. You probably have to take care of their alignment and arrangement, though, and probably also for their behaviour. Use a TLayout, Padding, Margins and alignment for that.

How to access iOS accelerometer in Delphi XE2?

8 votes

How do I access the accelerometer in iOS using Delphi XE2?

I tried looking through the IDE but did not find a component.

Delphi XE2 supports deploying to OSX on a mac. Deploying to an iPhone is apparently pretty easy, but it still involves using XCode as a final deployment tool. Since Delphi doesn't "officially" support deploying to iPhone hardware, I doubt they have included any components that are specific to it.

Disclaimer: I just downloaded XE2 a few hours ago, and I've only deployed one mac application so far (and it worked beautifully). So I'm far from an expert.

Which library for XML files in a Delphi Cross-platform application?

8 votes

I'm writing a FireMonkey application which must run in Windows as well in OSX. Until now I've used MSXML for my Windows apps, but of course this library is not compatible with OSX. So the question is, does Delphi XE2 include any XML library compatible with OSX, or is there a third-party XML library compatible with OSX?

In unit Xml.XMLDoc; you have a TXMLDocument; If you choose DOMVendor := ADOM XML v4, it's available for Windows and OSX.

It's directly available from the Tool palette.