David Intersimone “David I”
Vice President of Developer Relations and Chief Evangelist davidi@embarcadero.com
Agenda
• RAD Studio XE2 Overview
• FireMonkey Overview
• Break
• FireMonkey Principles
• Applied FireMonkey
• Break
• Platform Considerations
• End-to-End FireMonkey
• Android and iOS mobile development with RadPHP XE2
• Delphi for 64-bit Windows
• Summary and Close
Windows, Macintosh, Web and Mobile Development
…and more!
• Write app once, compile for multiple platforms
• Data-rich, Component-based
• Delphi and C++ native code performance
• Delphi for 64-bit Windows
• VCL Styles
• RadPHP for full visual web development
The Next Generation Business Application Platform
• Stunning HD and 3D
Business Applications
• Native Power and Performance
• Connect with any Data and Services
• Full Suite of UI Controls
• Visualize Live Data
• Styled Vector UIs without coding
• Communicate with Animations
• No-Code Hardware Effects
• High-speed connectivity to popular databases
• Multi-tier applications
• Clients on multiple computers and devices
• Connect to the world of data, services, and the cloud
• Native mobile apps for DataSnap
– iOS, Android, Blackberry, and Windows Phone 7
– Delphi and C++Builder DataSnap Servers
• Mobile-optimized PHP web apps
– Web apps that look great
– Web apps that work great on mobile devices
– Package applications for distribution
– Sell on Apple App Store and Android
Marketplace
RAD Studio XE2 - Editions for Every Developer
• Starter
(Delphi/C++Builder)
• Professional
• Enterprise
• Ultimate
• Architect
• Frequent and regular FireMonkey updates
• Expanded Mobile UI and Device support including
– Location, Camera, Accelerometers, etc.
• Next generation compilers
– Delphi compiler - multiple HW/OS targets
– RAD C++ compiler - multiple HW/OS targets
– 64bit RAD C++
– GPU computing
– Parallel programming
– Delphi and C++ native ARM Support
• Extended iOS support
• Android support
• Win8/Metro support - Intel & ARM
The Next Generation Application Development Platform
FireMonkey
Next generation CPU/GPU powered application platform for
business, enabling developers to rapidly build visually engaging
HD and 3D applications with blazing performance on
Windows, Mac and Mobile
• 90’s Windows user experiences
• Confined to mouse/keyboard interaction
• Complex to learn - slow to use
Consumer Software - Innovative User Experience
• Media and graphics rich user experiences
• Intuitive and interactive – easy to learn
• Touch and motion interaction
• Media and graphics Rich user experiences
• Intuitive and interactive – easy to learn
• Simulated real world physics
• Touch and motion interaction
• ISV’s / Packaged Software
• Healthcare / Medical
• Manufacturing
• Financial Services
• Telecommunications
• Energy
• Aviation & Automotive
• BioSciences
• Pharmaceuticals
• Utilities
Shortcomings of Today’s Solutions
Script and VM/JIT engines lack UX (User Experience) performance, responsiveness, and hardware accessibility for desktop business, ISV, and Vertical industry applications
Managed RIA
HTML5/CSS3 Game Engine
FireMonkey
VCL
UE Performance
MFC
Business SW is stuck here
FireMonkey – Rich Business Applications
More visually stunning and interactive
More power and performance
More connected
FireMonkey – Rich Business Applications
More visually stunning and interactive
More power and performance
More connected
• High performance GPU powered Scalable Vector Uis
• Maximum resolution on any device
• Hundreds of visual UI components
• GPU based Style Engine to control UI look & feel
• HUDs with transparencies and transition effects
• GPU powered 3D Forms
• Hardware based lighting, textures, and animation
• 3D Forms can contain HD UI elements and effects
• 50+ Photoshop-like GPU Effects
• Simultaneous multiple effects without performance hit
• Path based animation for all HD and 3D UI and graphics
• Delphi and C++ project types
• HD and 3D business apps and database
• Using Styles
• Using Effects and Animations
FireMonkey – Rich Business Applications
More visually stunning and interactive
More power and performance
More connected
Development Speed – Fast Prototyping
• Rapid Application Development to reduce development time
• Show customers what they are looking for with fast prototyping
• Easily move from prototype to production without wasted effort
Development Speed - Built-in Components
• Built-in advanced components to increase quality and functionality including:
• user interface components
• database
• multi-tier
• web apps
• Extend and customize components
• Create your own components
• Use free and commercial components created by the developer community
Native CPU/GPU Application Platform
• Compile natively to Windows, Mac, and iOS
• Application, database, and animation are CPU powered
• All UI, graphics, and effects are GPU powered
• Pixel Shader
• Simple native Windows/Mac/iOS demo
FireMonkey – Rich Business Applications
More visually stunning and interactive
More power and performance
More connected
Enterprise Database Connectivity
• Built-in native connectivity to all popular databases
• Connectivity with Amazon and Azure cloud services
LiveBindings Data Visualization
• Connect any UI, HD, or 3D graphics to any data source
• Create active “interdependent” bindings
• FireFlow
• MultiFormView
• MultiFormViewApp
• VCL and FireMonkey together
• MIDA VCL to FireMonkey converter – first look
Overview Summary
Quickly create visually stunning HD and 3D business applications with blazing native performance on Windows, Mac and iOS
Ensure high performance of your business applications by utilizing the full GPU power of today’s hardware
Handle any architecture requirement with the ability to easily connect to multiple devices, databases, protocols and services
Lights! Camera! Action!
• FireMonkey takes advantage of GPU whenever possible
• HD Form can be rendered on a computer without a
GPU with a few restrictions:
– No TViewport3D, No Shader based Filters
• A 3D Form requires a GPU - performs sophisticated transitions and manipulations of the user interface…
… in other words, a 3D form may be the best choice for building a sophisticated HD user interface
• FMX and VCL share Common Ancestry
• TObject
TPersistent
TComponent
• After TComponent dramatically different…
Courtesy: Ray Konopka
Raize Software
40
Courtesy: Ray Konopka
Raize Software
Courtesy: Ray Konopka
Raize Software
• Event model is the same
• Persistence is shared
• No Component Messages in FMX
• Coordinate System
– Origin is upper left
– VCL – Integer
– FMX – Floating-point
• Property changes
– Caption
➜
Text (except for TForm)
– Left, Top
➜
Position.X, Position.Y
Courtesy: Ray Konopka
Raize Software
43
• Concept of Ownership is the same
• FMX has the notion of Parent, but it is not quite the same as in VCL
• Any control can be the parent of another control
– Not restricted to container-like controls.
– e.g. a TEdit can be the parent of a TLabel
• Child objects share attributes of parent
– Coordinate space
– Visibility & Opacity
– Rotation & Scale.
Courtesy: Ray Konopka
Raize Software
44
• More abstract in FMX than in VCL
– i.e. not a direct wrapper around device context
• Fills and Strokes handled by separate calls
– FillRect
– DrawRect
• Text displayed using FillText
– Draws text and fills with specified TBrush
– Allows gradient fills in text
• However, rarely use TCanvas directly
– Use primitives instead.
Courtesy: Ray Konopka
Raize Software
45
RTL
VCL
FMX
Win32
✔
✔
✔
Win64
✔
✔
✔
OSX32
✔
✔ iOS
✔
✔
• RTL is shared between VCL & FMX
• VCL and FMX are more than Component
Libraries, they are Application frameworks
• As a result, you cannot intermix VCL & FMX in the same application.
Courtesy: Ray Konopka
Raize Software
46
• One object model to target multiple platforms
• FM uses right-handed orientation in 3D
• Hardware acceleration
– Windows – DirectX
– MacOS – OpenGL
– iOS – OpenGL ES
*) Delphi only in XE2
*)
• Windows - Direct2D for HD, Direct3D for 3D
• Note: FireMonkey can use GDI+ for HD vector forms/controls, when GPU is not available
• Mac - Quartz for HD, OpenGL for 3D
• iOS Core:Graphics for HD, OpenGL/ES for 3D
• HD
– TLayout, TScaledLayout
– TGridLayout, TScrollBox
– Shapes
• 3D
– TLayout3D, TLayer3D
– TViewport3D
– TCamera, TLight
– Shapes including TMesh, TModel3D, TGrid3D
• Grids
– TStringGrid, TGrid
• UI guidelines and things to consider
– Effects (glow) to draw attention to control
– Animations for appearance of UI elements
– Opacity – dim parts of a complex form
– Move non-focus parts of 3D UI into the distance
– Using a 2D mouse in a 3D world – button use
– Use ViewPort3D in an HD form
• Controls Demo – scaling forms/controls
• Lights, Camera, Action!
Styles, Animations, Filters and LiveBindings
Applied FireMonkey
• Styles
• Animations
• Effects/Filters
• Building Components
• LiveBindings
• FireMonkey Stylebook
– Any object inherited from TBaseObject
– Set StyleName to identify
– Found using FindStyleResource method from parented object
– Stored In / Loaded From a stream file
• FireMonkey Styles
– A collection of FireMonkey resource style
– WPF type of implementation
– Styles can be inherited, saved, loaded
– Look and Feel style files for Win7, MacOS, iOS and custom themes
• Used to modify property values over time
• Machine speed independent
• Can be looped and / or reversed
• Can follow a variety of time / value curves
• Can be triggered by MouseOver, Focus,
Visibility, etc.
• Can be applied to bitmaps
• Can be applied to controls
• Can be triggered by MouseOver, Focus,
Visibility, etc.
• GPU shader based implementation
• Bruno/Ray slides
• Docwilki
• Basically the same as creating VCL components
• Prepare for new component
– Create a new directory
– Create a test application
• Create the component unit
– Manually or Component Expert?
– Name the component
– Create the component class
• Test runtime behavior
– Dynamically create component in test application.
Courtesy: Ray Konopka
Raize Software
59
• Register and install component
– Register component in a new or existing registration unit
– Add component unit to a runtime package
– Add registration unit to design package
• which will require the runtime package
– Build packages, deploy, install
• Test design-time behavior.
Courtesy: Ray Konopka
Raize Software
60
• Use the built-in Style Designer
• Save to *.style file
• Create separate styles to handle platform differences
Courtesy: Ray Konopka
Raize Software
61
• Use Styles
– Name style elements appropriately
– Be sure to document all Style contracts
• Utilize primitives for painting whenever possible
– When used within styles, they can be replaced or subclassed
• Complex controls can be built through code with styled components.
Courtesy: Ray Konopka
Raize Software
62
• Allows developers to create live binding in run-time between components/objects at design-time.
• The LiveBinding visual components use the engine:
– TBindScope for bindings to components
– TBindScopeDB for bindings to databases
– TBindingsList for holding of binding lists
• A number of conversion services in the box and allows to create new conversion service
• Automatic updates
– Expressions automatically re-evaluated when a variable (e.g.; property) referenced by an expression has changed value.
– Requires - external notification – Notify(object, ‘variable’);
• Operators: +, -, /, *
• Literals: ‘abc’, 1, 1.23, True, False, nil
• Scope: Provides symbols and values available to an expression.
Includes operators. Scopes may be nested.
• TDictionaryScope: Associates a name with an object
• Expression string: String to evaluate
• TBindingExpression: Expression engine object which holds a scope and expression string.
• Evaluate: Expression engine processes the expression string and returns a value.
• TValue: Delphi RTTI representation of a value. May be an object, string, integer, array, etc.
• Built-in Methods: Global methods registered by the expression engine
• WrapObject(): Create a scope which exposes members of the object, including properties and methods
• RTTI: Delphi RTTI is used by expression engine to access the member of an object
• Self: A scope can be associated with “Self”. Members can be accessed without a qualifier.
• Association: A scope can be associated with a name. The name is used as a qualifier.
• Custom Methods: Global methods registered in user code
• Binding: Expressions are used to assign from one value to another
• Input expression and scope: Evaluated to get the input value
• Output expression and scope: Evaluated to get the output location
• Managed: Managed bindings are owned by the expression engine and may be automatically reevaluated.
• Unmanaged: Unmanaged bindings are owned by application and must be explicitly evaluated by calling Evaluate.
• Output Converters
– Used when assigning the value of the input to the location of the output.
– Typically used to handle assignment of mismatched types such as integer to string.
• Notify()
– The Notify method informs the manager that the value of an object/property has changed.
– The manager will re-evaluate dependent bindings.
• Events
– Events are called during expression evaluation.
• OnAssigning
• OnAssign
• OnException
• TBindExpression
– Component to create a managed or unmanaged binding
– Properties
• SourceComponent
• SourceExpression
• ControlComponent
• ControlExpression
• Direction
• TBindScope
– Component to wrap a TObject in a scope
– Properties
• DataObject
• TBindExprItems
– Component to create one or more managed or unmanaged binding
– Properties
• SourceComponent
• SourceExpression
• ControlComponent
• ControlExpression
• FormatExpressions collection
• TBindingsList: List of binding components such as
TBindExprItems
• Bindings List Editor: Edits the list of binding components
• TBindExpression
– properties
• Active
– Binding expressions are evaluated when Active is set to True
• AutoActivate
– Set Active when the component is loaded
• Expression Editor
– Edit the expression strings of a binding component
– Test expressions
• Styles
– Loading a style from resource, file?
– Modifying styles at design time and runtime
• Style Lookup, Apply Style?
• Animations and effects
• LiveBindings
– BindScopeDB – uses DataSource
– Managed and Unmanaged bindings
– Circle example method for condition test returning color
• Building components - TRkDialogButtons for FMX
Deployment to Windows, OSX and iOS
Platform Considerations
• Project Types
• Windows, Mac, iOS
• Project | Deployment
– Feature Files
– Additional files
• Platform Assistant
– Debugging, Deployment
– Win32, Win64, Mac
• FM is a platform that supports
– RTL
– GUI
– Database
– Operating System
• Compile / Run on all platforms we support *
• * subset for mobile platforms
• UI design on Windows
• Handling devices, orientation
• Code for iOS hardware, file system, OS
• Anders’ slides
• http://itunes.apple.com/us/app/andersanalog-clock/id475178939?mt=8
• Find the problems… ;)
– Green buttons? Maybe…
– Button font size?
– Scroll bars?
• That’s better!
• Need to turn off scroll bars!
• Edit box at the bottom? No!
– Has to be upper half of screen
– Why?
• We’re getting somewhere!
• But wait…
• Rounded corners?
• Nice!
• Modeled after the Contacts app
– Edit boxes have labels in them
– Text fields are right adjusted
• Minute details remain
– Text in memo should be padded more
– Maybe Panel with Label and Edit (LJ) inside?
– Button should have rounded edges to it
• Close!
•
• iOS Human Interface Guidelines web site
– http://developer.apple.com/library/ios/#documen tation/UserExperience/Conceptual/MobileHIG/Int roduction/Introduction.html
• Apple’s iOS Human Interface Guidelines
– http://developer.apple.com/library/ios/document ation/userexperience/conceptual/mobilehig/Mobi leHIG.pdf
• TMenuBar – UseOSMenu property
• Dialogs, ShowMessage
• File System – IOUtils – Win/Mac
• Malcolm’s hidden user files
• TRegistry vs TIniFile
• TOSVersion (run time), conditional defines
(compile time)
• File Volume/Path issues
• DLLs, Dylibs
• Debugging
• TOSversion database example
• UseMenuBar
• iOS client applications
Enterprise Solutions
• CORBA
• JEE
• WCF
• DataSnap
• …
• SOA
• SaaS
• PaaS
• …
End-to-End FireMonkey
FireMonkey client and …
• Scenario 1: Remote RDBMS or Cloud Storage
• Scenario 2: XML/SOAP & JSON/REST Web Services
• Scenario 3: Delphi/C++ DataSnap server deployed to EC2 cloud
• Scenario 4: Delphi FM iOS client to DataSnap server
• Scenario 5: FireMonkey client connected to Enterprise
Infrastructure – JEE, CORBA, and .NET
Scenario 5: FireMonkey & .NET Web Service
• .NET WCF web service
• Embarcadero Prism console application
• FireMonkey client
• WSDL importer and HTTPRIO component
• Embarcadero Prism WCF calculator service
JQueryMobile visual, component-based development of mobile optimized web pages
Create iOS and
Android applications that you can sell on the
Apple and Android app stores
• RadPHP XE2 – web mobile client
• RadPHP XE2 – native mobile clients
• Integer, Longint, Cardinal – still 32bits
• Int64, UInt64 – still 64bits
• UnicodeString, AnsiString, WideString
• Exceptions
• Runtime Library (RTL)
• SysUtils, Classes, etc…
• NativeInt, NativeUint – 64bits
• Pointer (all pointers) – 64bits
• Dynamic Arrays – 64bit indexing
• Floating point math - Double
Pointer types Delphi/32 Delphi/64
Pointer
String
Class instance
Class reference
Interface
AnsiString
WideString
UnicodeString
Procedure pointer
Dynamic array
PAnsiChar
PWideChar
PChar
4 bytes 8 bytes
• Same Windows API
– CreateWindowEx, PeekMessage, etc..
• Same Delphi RTL
– SysUtils, Classes,
Generics.Collections, etc…
• Same VCL
– Forms, Graphics, Controls, Menus, etc..
Delphi 64-bit on Windows – some gotcha’s
• SizeOf(Pointer) <> SizeOf(Integer)
– Integer<->Pointer casts will break in 64bit
– SizeOf(THandle) = SizeOf(Pointer)
– All Handles = SizeOf(Pointer) (HWND, HDC, etc..).
• All code in process must be 64bit
– Must have 64bit versions of external non-Delphi libraries (DLLs)
• One, and only one, calling convention
– register, pascal, cdecl, stdcall are ignored.
• safecall is still “special”
• Old “pointer math” code may break
– Works in 32 and 64bit: MyPtr := PByte(P) + 10;
• TList’s internal FList is now a TPointerList. Used to be a PPointerList. Removing ^ should be sufficient to port from 32-bit to 64-bit.
• Tag property is now a NativeInt (32-bit vs 64-bit)
Delphi 64-bit on Windows – some gotcha’s
• Inline Assembly
– Cannot mix asm blocks with Pascal code
– Only procedural level asm blocks supported
– Stack must be 16-byte aligned at each call instruction
– Define locals for temp storage
– Do not modify the RSP stack pointer
– New unified calling convention. First 4 parameters in registers, RCX, RDX,
R8, R9 (or XMM0-XMM3)
• Exception unwinding
– No change for pure Delphi code. Exceptions function identically.
– Inline Assembly can cause exception unwinding to fail if not properly written.
• SHL/SHR – 32-bit values (Integer et al) will only shift in 32-bit space. 64-bit values will of course shift in 64-bit space.
• No Extended type in 64-bit. Use TExtendedRec80 if necessary (binary files with
Extendeds in them for instance)
• SetWindowLong / GetWindowLong should be replaced by SetWindowLongPtr /
GetWindowLongPtr for GWLP_HINSTANCE,
GWLP_WNDPROC, etc… as they return pointers and handles.
– Pointers passed to SetWindowLongPtr should be typecasted to LONG_PTR and not to Integer / Longint.
• SetWindowLong mapped to SetWindowLongPtr in
Windows.pas.
– Calls to our declaration of SetWindowLong are safe, as long as they are cast correctly.
• Use explicit casts to WPARAM and LPARAM where appropriate.
– Example: Passing pointers through SendMessage
SendMessage(hWnd, WM_SETTEXT, 0,
LPARAM(@MyCharArray));
• Use LRESULT to cast message results
– Example: Message.Result := LRESULT(Self);
• Message cracker records (TWMxxx) changed
– Alignment changes and field-size changes
• FireMonkey - The Next Generation Business
Application Platform
• Fully harness the powerful GPU graphics hardware
• Rapidly build visually spectacular applications
• Invest in one platform and deploy to numerous OS-s
• Delphi and C++ compiled, native executable
• Fully programmable animations and effects
• Your imagination is the only limit !!!
• Go FIREMONKEY !!!
The ultimate application development suite for Windows, Mac, mobile and Web
• Deliver Fast Native Applications on Windows, Mac, Web and Mobile
• Speed Up Your Development Process with RAD
• Create Visually Stunning and Interactive
Business Applications
• Build Applications that Connect Everywhere
• Break Free from Grids – Visualize Live Data
• RAD Studio XE2 samples on SourceForge
– https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branch es/RadStudio_XE2/
• FireMonkey components Guide
– http://docwiki.embarcadero.com/RADStudio/en/FireMonkey_Components_G uide
• Anders Ohlsson FireMonkey iOS blog
– http://blogs.embarcadero.com/ao/2011/10/26/39188
• CodeRage 6 – session replays
– http://cc.embarcadero.com/coderage
• RAIZE Software
– http://www.raize.com
• MIDA VCL to FireMonkey Converter
– http://midafiremonkey.wordpress.com/
• JQueryMobile
– http://jquerymobile.com/
S nákupem licence Delphi nebo RAD
Studia XE2, plné verze nebo upgrade edice …
… získáte všechny tyto nástroje
Rapid SQL XE2 – ZDARMA
FastCube – ZDARMA
Rapid SQL XE2 – ZDARMA
FastCube – ZDARMA
DB Optimizer XE2 – ZDARMA
Rapid SQL XE2 – ZDARMA
FastCube – ZDARMA
DB Optimizer XE2 – ZDARMA
DB Change Manager XE2 – ZDARMA
Nabídka platí pro objednávky podané od 3.11. do 30.12.2011
Produkty získané zdarma si musíte vyžádat do 15.1.2012
• Rapid SQL XE2 – je integrované vývojové prostředí jazyka
SQL, které vám umožní vytvářet výkonný kód SQL pro vaše aplikace napsané v Delphi a C++Builderu.
• Fastcube – je nástroj pro efektivní analýzu dat.
• DB Optimizer XE2 – pomůže vám zvýšit celkový výkon vašich databázových aplikací a maximalizovat odezvu databází.
• DB Change Manager XE2 – umožní vám sledovat a zvládat změny v používaných databázích stejným způsobem, jakým například sledujete změny zdrojového kódu.
• Možnost upgrade z verze 2007 na verzi novější skončí zároveň s koncem roku 2011
• S nákupem verze XE2 produktu z rodiny RAD Studio XE2 získáte i
starší verze XE, 2010, 2009, 2007 a Delphi 7 či C++Builder 6
• S nákupem verze XE2 získáte to, co zatím nemáte a jinde nenajdete:
– 64bitový kompilátor Delphi pro aplikace, které využijí možnosti nejnovějšího hardware
– Skutečně oslňující vizuální obchodní aplikace vytvořené pomocí komponent FireMonkey™
– Výkonné nativní aplikace pro Windows, Mac a iOS
– LiveBindings™ dovolící propojit jakýkoli vizuální prvek s libovolným typem dat
– Propojitenost s mobilními systémy a cloudem pomocí vícevrstvé technologie DataSnap
Borland s.r.o.
Belgická 15, 120 00 Praha 2, CZ e-mail: info@embt.cz
telefon: +420 273 132 190
www.embarcadero.com/products/firemonkey davidi@embarcadero.com