Blaise 33

24
APPLICATION TETHERING COMPONENTS EXTEND YOUR EXISTING WINDOWS APPLICATION S TO MOBILE WITHOUT HAVING TO PORT YOUR WHOLE WINDOWS APPLICATION. PICK THE FEATURES THAT MAKE SENSE ON MOBILE AND EASILY INTERACT WITH YOUR EXISTING WINDOWS APPLICATIONS . CONNECT YOUR DESKTOP (VCL AND FMX) APPLICATIONS AND MOBILE APPS. CREATE MOBILE COMP ANION APPS FOR YOUR VCL APPLICATIONS WORKS VIA WI- FI AND ON YOUR LOCAL NETWORK. FUTURE VERSIONS WILL SUPPORT BLUETOOTH. TASKBAR COMPONENT COMPONENT FOR PRESENTING PREVIEWS OF MULTIPLE WINDOWS THAT ARE sELECTA BLE IN YOUR APP WITH BUTTON CONTROLS WITHIN THE PREVIEWS AUTOMA TIC OR CUSTOM PREVIEWS SHOW PROGRESS IN THE TASKBAR BUTTON FOR YOUR APPLICATION OVERLAY ICONS ON TASKBAR BUTTONS CLOUD SERVICE (BAAS) INTEGRATION WITH COMPONENTS FOR KINVEY AND PARSE INTEGRATE WITH LEADING BACKEND AS A SERVICE PROVIDERS TO ADD FUNCTIONALITY AND PLATFORM SERVICES TO YOUR MOBILE APPLICATIONS . YOU GET EASY ACCESS TO COMMON SERVICES IN THE CLOUD WITHOUT HAVING TO BUILD OR MAINTAIN THE BACKEND SERVICES YOURSELF. USE PUSH NOTIFICATIONS TO ENGAGE YOUR USERS ON ANY DEVICE OR PLATFORM ACCESS DATA AND OBJECT STORAGE IN THE CLOUD USER AUTHENTICA TION BUILDS ON THE REST CLIENT SUPPORT INTRODUCED IN XE5. SUPPORTS THE THREE MOST POPULAR BAAS PROVIDERS – KINVEY AND PARSE WITH A COMMON API COMPONENT SET NEW VCL STYLES GIVE YOUR APPLICATIONS AN UPDATED WINDOWS OR CUSTOM LOOK INCLUDES A WINDOWS TABLE T STYLE SUPPORTS WINDOWS 7 AND WINDOWS 8. FULLY STYLE YOUR APPLICATIONS INCLUDING MENUS AND BORDERS VCL SENSOR COMPONENTS SENSORS ARE EVERYWHERE, EVEN FOR WINDOWS USERS WITH NEW WINDOWS TABLE TS LIKE THE SURFACE PRO.NOW YOUR DELPHI APPS CAN ADD LOCATION, MOVEMENT AND OTHER FEATURES. ACCESS DEVICE SENSORS FROM VCL APPS RUNNING ON WINDOWS TABLETS ACCELEROMETER, GPS AND GYROSCOPE FUNCTIONALITY IN-APP PURCHASE AND IN-APP ADVERTISING MOBILE APPS ARE A REVENUE GENERAT ING OPPORTUNITY FOR APPLICATION DEVELOPERS . NOW YOU CAN MONETIZE YOUR MOBILE APPS BY INTEGRATING IN-APP PURCHASE FUNCTIONALITY AND ADVERTISING. SELL CONTENT, FUNCTIONALITY, SERVICES AND SUBSCRIPTIONS ON IOS AND ANDROID SUPPORTS THE TOP AD NETWORKS (GOOGLE ADMOB AND APPLE IAD) CREATE APPS FOR GOOGLE GLASS MULTI-DEVICE APPLICATION DEVELOPMENT WITH DELPHI NOW EXTENDS BEYOND PCS, TABLETS AND SMARTPHONES TO WEARABLES.CREATE ANDROID APPS THAT RUN ON GOOGLE GLASS.NEW CUSTOM STYLE WITH GOOGLE GLASS OPTIMIZED LOOK AND RESOLUTION GOOGLE GLASS DEVICE DESIGNER TEMPLA TE ACCESSIBILITY MAKE YOUR APPLICATIONS EASIER TO USE FOR MORE USERS, INCLUDING THOSE USING SCREEN READER SOFTWARE.NEW ACCESSIBILITY FEATURES FOR FM DESKTOP APPLICATIONS SUPPOR TS JAWS ON WINDOWS AND VOICEOVER ON MAC OS X QUALITY, PERFORMANCE AND STABILITY GET THE BEST DEVELOPMENT EXPERIENCE AND DELIVER THE BEST USER EXPERIENCE FOR YOUR USERS ADDRESSED OVER 2,000 REPORTED ISSUES INCREASED OVERALL APPLICATION RUNTIME PERFORMANCE ON ALL PLATFORMS FIND DEFINITION AND FIND REFERENCES FIND ALL REFERENCES TO A SELECTED ITEM ACROSS YOUR ENTIRE PROJECT FOR C++ ON WIN64, IOS AND ANDROID CORE AND DATABASE FEATURES CORE ENHANCEMENTS THROUGHOUT THE PRODUCT DAT ASNAP PERFORMANCE AND UPDATED WIZARDS DATABASE AND FIREDAC ENHANCEMENTS, FDMEMTABLE RTL REFACTORING AND ENHANCEMENTS DATABASE EXPLORER FOR FIREDAC APACHE SUPPORT (WEBBROKER) DIRECTX 11 HEADERS IREDAC INFORMIX DRIVER UPDATES APACHE C++ SUPPORT SEE DETAILS INSIDE: PAGE 43 Publisher: Foundation for Supporting the Pascal Programming Language in collaboration with the Dutch Pascal User Group (Pascal Gebruikers Groep) © Stichting Ondersteuning Programmeertaal Pascal 33 33 33 D E L P H I, L A Z A R U S, O X Y G E N E, S M A R T ,  A N D P A S C A L R E L A T E D L A N G U A G E S  A N D R O I D, I O S, M A C , W I N D O W S & L I N U X Professor Dr . Niklaus Wirth Appmethod    G   o   o   g    l   e    G    l   a   s   s   D   E   L   P   H   I    X   E  6    I  S   S   I   M   P   L   Y  A   M  A   Z   I   N  G maXbox Starter 5 Start with DLL A Library for All Suite Rays components Interview with Pofessor Dr. Niklaus Wirth By Max Kleiner By Programming Truth Table reduction By David Dirkse Databases for XE6 By Cary Jensen Updating DotTapper By Jeremy North By Fikret Hasovitch By Max Kleiner By Rik Smit Steps in MindScape AppView Step-By-Step  Jeroen Pluimers New: Delphi XE 6 Six new ready to use components!  

Transcript of Blaise 33

Page 1: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 1/24

APPLICATION TETHERING COMPONENTSEXTEND YOUR EXISTING WINDOWS APPLICATIONS TO MOBILE WITHOUTHAVING TO PORT YOUR WHOLE WINDOWS APPLICATION. PICK THE FEATURES THATMAKE SENSE ON MOBILE AND EASILY INTERACT WITH YOUR EXISTING WINDOWSAPPLICATIONS. CONNECT YOUR DESKTOP (VCL AND FMX) APPLICATIONS AND MOBILEAPPS. CREATE MOBILE COMPANION APPS FOR YOUR VCL APPLICATIONS WORKS VIA WI-FI AND ON YOUR LOCAL NETWORK. FUTURE VERSIONS WILL SUPPORT BLUETOOTH.TASKBAR COMPONENTCOMPONENT FOR PRESENTING PREVIEWS OF MULTIPLE WINDOWS THAT AREsELECTABLE IN YOUR APP WITH BUTTON CONTROLS WITHIN THE PREVIEWS AUTOMATICOR CUSTOM PREVIEWS SHOW PROGRESS IN THE TASKBAR BUTTON FOR YOURAPPLICATION OVERLAY ICONS ON TASKBAR BUTTONSCLOUD SERVICE (BAAS) INTEGRATION WITH COMPONENTSFOR KINVEY AND PARSEINTEGRATE WITH LEADING BACKEND AS A SERVICE PROVIDERSTO ADD FUNCTIONALITY AND PLATFORM SERVICES TO YOUR MOBILEAPPLICATIONS. YOU GET EASY ACCESS TO COMMON SERVICES INTHE CLOUD WITHOUT HAVING TO BUILD OR MAINTAIN THE BACKENDSERVICES YOURSELF. USE PUSH NOTIFICATIONS TO ENGAGE YOURUSERS ON ANY DEVICE OR PLATFORM ACCESS DATA AND OBJECT STORAGEIN THE CLOUD USER AUTHENTICATION BUILDS ON THE REST CLIENTSUPPORT INTRODUCED IN XE5. SUPPORTS THE THREE MOST POPULAR BAASPROVIDERS – KINVEY AND PARSE WITH A COMMON API COMPONENT SETNEW VCL STYLESGIVE YOUR APPLICATIONS AN UPDATED WINDOWS OR CUSTOM LOOKINCLUDES A WINDOWS TABLET STYLE SUPPORTS WINDOWS 7AND WINDOWS 8. FULLY STYLE YOUR APPLICATIONSINCLUDING MENUS AND BORDERSVCL SENSOR COMPONENTSSENSORS ARE EVERYWHERE, EVEN FORWINDOWS USERS WITH NEW WINDOWSTABLETS LIKE THE SURFACE PRO.NOW YOUR DELPHI APPS CANADD LOCATION, MOVEMENT AND OTHER FEATURES.ACCESS DEVICE SENSORS FROM VCL APPSRUNNING ON WINDOWS TABLETSACCELEROMETER, GPS AND GYROSCOPE FUNCTIONALITY

IN-APP PURCHASE AND IN-APP ADVERTISINGMOBILE APPS ARE A REVENUEGENERATING OPPORTUNITY FORAPPLICATION DEVELOPERS. NOW YOUCAN MONETIZE YOUR MOBILEAPPS BY INTEGRATING IN-APP PURCHASEFUNCTIONALITY AND ADVERTISING.SELL CONTENT, FUNCTIONALITY, SERVICESAND SUBSCRIPTIONS ON IOS AND ANDROIDSUPPORTS THE TOP AD NETWORKS(GOOGLE ADMOB AND APPLE IAD)CREATE APPS FOR GOOGLE GLASSMULTI-DEVICE APPLICATIONDEVELOPMENT WITH DELPHINOW EXTENDS BEYOND PCS,TABLETS AND SMARTPHONES TO WEARABLES.CREATE ANDROIDAPPS THAT RUN ON GOOGLE GLASS.NEW CUSTOM STYLE WITH GOOGLE GLASSOPTIMIZED LOOK AND RESOLUTION GOOGLE GLASS DEVICE DESIGNER TEMPLATE

ACCESSIBILITYMAKE YOUR APPLICATIONS EASIER TO USE FOR MORE USERS, INCLUDING THOSE USINGSCREEN READER SOFTWARE.NEW ACCESSIBILITY FEATURES FOR FM DESKTOPAPPLICATIONS SUPPORTS JAWS ON WINDOWS AND VOICEOVER ON MAC OS XQUALITY, PERFORMANCE AND STABILITYGET THE BEST DEVELOPMENT EXPERIENCE AND DELIVER THE BEST USER EXPERIENCEFOR YOUR USERS ADDRESSED OVER 2,000 REPORTED ISSUES INCREASED OVERALLAPPLICATION RUNTIME PERFORMANCE ON ALL PLATFORMSFIND DEFINITION AND FIND REFERENCESFIND ALL REFERENCES TO A SELECTED ITEM ACROSS YOUR ENTIRE PROJECTFOR C++ ON WIN64, IOS AND ANDROIDCORE AND DATABASE FEATURESCORE ENHANCEMENTS THROUGHOUT THE PRODUCT DATASNAPPERFORMANCE AND UPDATED WIZARDS DATABASE AND FIREDACENHANCEMENTS, FDMEMTABLE RTL REFACTORING ANDENHANCEMENTS DATABASE EXPLORER FOR FIREDAC APACHESUPPORT (WEBBROKER) DIRECTX 11 HEADERS IREDACINFORMIX DRIVER UPDATES

APACHE C++ SUPPORT

SEE DETAILS INSIDE: PAGE 43

Publisher: Foundation for Supporting the Pascal Programming Languagein collaboration with the Dutch Pascal User Group (Pascal Gebruikers Groep)

© Stichting Ondersteuning Programmeertaal Pascal

333333D E L P H I, L A Z A R U S, O X Y G E N E, S M A R T, A N D P A S C A L R E L A T E D L A N G U A G E S A N D R O I D, I O S, M A C , W I N D O W S & L I N U X

Professor Dr. Niklaus Wirth

Appmethod

   G  o  o  g   l  e

   G   l  a  s  s

  D  E  L  P  H  I

   X  E 6

 

  I S  S  I  M  P

  L  Y

 A  M A

  Z  I  N G

maXbox Starter 5 Start with DLL A Library for All

Suite Rays componentsInterview with Pofessor Dr. Niklaus Wirth

By Max Kleiner 

By

Programming Truth Table reductionBy David Dirkse

Databases for XE6By Cary Jensen

Updating DotTapper

By Jeremy North

By Fikret Hasovitch

By Max Kleiner 

By Rik Smit

Steps in MindScape AppView Step-By-Step Jeroen Pluimers

New: Delphi XE 6

Six new ready to use components!

 

Page 2: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 2/24

CONTENTSArticle overview

2 Nr 1 / 2014 BLAISE PASCAL MAGAZINE

BLAISE PASCAL MAGAZINEBLAISE PASCAL MAGAZINED E L P H I, L A Z A R U S, O X Y G E N E, S M A R T, A N D P A S C A L R E L A T E DL A N G U A G E S F O R A N D R O I D, I O S, M A C, W I N D O W S & L I N U X

Interview withProfessor Dr.Wirth

A story about Pascalbecomming famous

an interview about the

great manbehind Pascal By Detlef Overbeek PAGE 35

 

Steps in MindScape AppViewStep-By-StepContinuation

of the articlein last double

issue Nr31/32 

By Jeroen Pluimers PAGE 26

Databases for XE6

By Cary Jensen

PAGE 59

Updating DotTapper  Suite Rays components By Rik Smit PAGE 14

By Jeremy North PAGE 53

Programming

Truth Table reduction 

By David DirksePAGE 46

maXbox Starter 5Start with DLL

A Library for All

By Max Kleiner PAGE 5

 

Components 4 Developers

By Fikret Hasovitch PAGE 65

maXbox Starter 5 Start with DLL A Library for All

Suite Rays components

Interview with Pofessor Dr. Niklaus Wirth By Max Kleiner Page 26

By

Programming Truth Table reduction By David Dirkse Page 46 

Databases for XE6 By Cary Jensen Page 59Updating DotTapper By Jeremy North Page 53 

By Fikret Hasovitch Page 65 

By Max Kleiner Page 5 

By Rik Smit Page 14

Steps in MindScape AppView Step-By-Step  Jeroen Pluimers Page 26

New: Delphi XE 6 Page 43

Six new ready to use components!

 

Articles

maXbox 

4COMPONENTS

DEVELOPERS

4COMPONENTS

DEVELOPERS

Bob Swart

 

Cary Jensen

DC/Baltimore May 5-6Chicago May 8-9

Frankfurt May26-27

Amsterdam June 12-13London June 18-19

  lphi

Developer Days

2014 Tour

New: Delphi XE6PAGE 43

Page 3: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 3/24

3Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

All material published in Blaise Pascal is copyright © SOPP Stichting Ondersteuning Programeertaal Pascal unless otherwise noted and maynot be copied, distributed or republished without written permission. Authors agree that code associated with their articles will be madeavailable to subscribers after publication by placing it on the website of the PGG for download, and that articles and code will be placed ondistributable data storage media. Use of program listings by subscribers for research and study purposes is allowed, but not for commercialpurposes. Commercial use of program listings and code is prohibited without the written permission of the author.

Copyright notice

Advertisers

Barnsten Pag 45BetterOffice Page 13/52Components 4 Developers Page 68Delphi Developer days Page 34/64Fastreport  Page 4Raize Software Page 22Pascon Page 2Smart Mobile Studio Page 23

AuthorsA Alexander

N Jeremy North,O Tim Opsteeg,

Howard Page-Clark, J

Alexeev

Michaël Van Canneyt,Daniele Teti

F Bruno Fierens

Fikret HasovicJ Cary JensenL Wagner R. Landgraf, Sergey LyubeznyyK Max KleinerM Kim Madsen, Felipe Monteiro de Cavalho

Inoussa Ouedraogo

 BC Marco Cantù,D David Dirkse,

G Primož Gabrijelčič,H

PS Rik Smit, Bob Swart,

Peter Bijlsma,

eroen Pluimers

Editors

Correctors

Trademarks

Caveat

Subscriptions

 www.blaisepascal.eu  [email protected] 

Subscriptions run 365 days. 

ABN AMRO Bank Account no. 44 19 60 863 

IBAN: NL82 ABNA 0441960863 BIC ABNANL2A VAT no.: 81 42 54 147Subscription [email protected]

Peter Bijlsma, W. (Wim) van Ingen Schenau, Rik Smit, 

Howard Page-Clark, James D. Duff 

All trademarks used are acknowledged as the property of their respective owners.Whilst we endeavour to ensure that what is published in the magazine is correct, we cannot accept responsibility for any errors or omissions.

If you notice something which may be incorrect, please contact the Editor and we will publish a correction where relevant.( 2013 prices )

1: Printed version: subscription € 60.-- Incl. VAT 6 % (including code, programs and printed magazine,6 issues per year excluding postage).

2: Electronic - non printed subscription € 45.-- Incl. VAT 21% (including code, programs and download magazine)

Subscriptions can be taken out online at or by written order, or by sending an email to

Subscriptions can start at any date. All issues published in the calendar year of the subscription will be sent as well.Subscriptions will not be prolonged without notice. Receipt of payment will be sent by email.

Subscriptions can be paid by sending the payment to:or by credit card: Paypal

Name: Pro Pascal Foundation-(Stichting Programmeertaal Pascal)

Edelstenenbaan 21 / 3402 XA IJsselstein, The Netherlands / Tel.: + 31 (0) 30 890.66.44 / Mobile: + 31 (0) 6 21.23.62.68

Foundation for Supporting the Pascal Programming Language (Stichting Ondersteuning Programeertaal Pascal)

Editor - in - chief 

News and Press Releases email only to [email protected] D. Overbeek, Netherlands Tel.: +31 (0)30 890.66.44 / Mobile: +31 (0)6 21.23.62.68

Alexander [email protected]

Peter Bijlsma [email protected]

Michaël Van Canneyt [email protected]

Marco Cantù [email protected] 

David [email protected]

Daniele [email protected]

Bruno Fierens [email protected] 

Primož Gabrijelčič [email protected]

Fikret [email protected] 

Cary [email protected] 

Wagner R. Landgraf  Sergey [email protected]

Kim [email protected] 

Felipe Monteiro de Cavalhofelipemonteiro.carvalho@gmail.

Mattias [email protected]

Jeremy [email protected] 

Tim Opsteeg Detlef [email protected]

Howard Page [email protected]

Jeroen [email protected] 

Rik [email protected]

Bob [email protected] 

Page 4: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 4/24

5Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Page 5: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 5/24

maXbox Starter 28

A static link remains constant during program executionwhile a dynamic link is created by the program as needed.DLLs can also contain just data. DLL files usually end withthe extension *.dll, *.exe, drv, or *.fon.This is how we declare a function we want to use from aDLL:Function

External

  ( : ;

: ; : ):;  ;

OpenProcess2 dwDesiredAccess DWORD

  bInheritHandle BOOL dwProcessId DWORDTHandle

'[email protected] stdcall'

Suppose you want to use the function OpenProcess of the 'kernel32.dll'.All you have to do is to declare above statement and youget access to the kernel!With external you made these functions available to callersexternal to the DLL, so we must export them or at least saythe function we use is from External. This means also touse the modifier stdcall because this is a C convention.The function name OpenProcess2 is different from theoriginal name OpenProcess! This is an alias to preventname conflicts or name it you like because you do haveconventions you are free to rename the function in yourscript.That's all for the meantime, now you can call the function:

And you get back the process handle like: > 904

Writeln intToStr ProcessHandle( + ( ));'Process Handle:'

A DLL can be used by several applications at the sametime. Some DLLs are provided with the Windowsoperating system and available for any Win application.Other DLLs are written for a particular application and areloaded within the application.Oh wait a minute, you can't call the function because thereis one parameter missing:

 In Linux we say  for shared objects.so

maXbox maXbox 

1.1 A Library for AllThe purpose of writing programs is communication.And communication needs structure. A DLL can help to

structure the system.

A DLL is not XML or UML those L stands for language.A DLL is a library, short for Dynamic Link Library, a

library of executable functions or data that can be used

by a Windows or Linux application.Typically, a DLL provides one or more particular functions

and a program accesses the functions by creating either

a static or dynamic link to the DLL.

Start with DLL

ProcessHandle

OpenProcess2 PROCESS_QUERY_INFORMATIONPROCESS_VM_READ false ProcessID

:=  (

, , );  or

ProcessHandleOpenProcess2 PROCESS_QUERY_INFORMATION

PROCESS_VM_READ false   ProcessID

:=(

  , , );or

The first is set of constants already declared, the second is just false but by the third you need the ProcessID to get thecorresponding handle, that's life.So you get the current ProcessId by simply call the function GetCurrentProcessID

ProcessHandle OpenProcess2 PROCESS_QUERY_INFORMATION

PROCESS_VM_READ false GetCurrentProcessID

:= (  , , );or

With our DLL that just copied and pasted from the scriptfolder, we will use a next example to retrieve version

information. Until this call here some more topics.• Windows DLLs usually have no safety whatsoever.The DLLs that interface with HW are kernel mode driversthat can wreak havoc and gone. Extreme care has to beused when passing parameters to the DLLs.Usually you have an interface module that establishes“mapping” between DLL and Pascal functions so thereshould be a tested environment in your box.

PROCESS_VM_READ is required to read memory in aprocess using. By the way the script you get all thisis: www.softwareschule.ch/examples/440_DLL_Tutor2.txt

The advantage of a DLL is:For most applications, packages in an object oriented senseprovide greater flexibility and are easier to create thanDLLs. However, there are several situations where DLLswould be better suited to your projects than packages:•

Your code module will be called fromnon-Pascal application.• You are extending the functionality of a Web server.• You are creating a code module to be used by third-

party developers.• Your project is an OLE container.

I don't explain those points just for your insights. Let mesay a few words about building a DLL which is not themeof this tutorial. When we update a DLL (change function'simplementation), we simply compile it, export some newroutines and ship the new version. All the applicationsusing this DLL will still work (unless, of course, you'veremoved or ruined existing exported routines).This solution does not support static binding. From a C orC++ application, static binding is achieved by linkingimport records (either import libraries or entries in theIMPORTS section of the application's Module DefinitionFile) to the calling application. Using standard Delphi,static binding is achieved using a declaration such as:functionstdcall external

( : ): ;;

xFoobox param Integer Integer

Foobox'mytools.dll' name ' ';

Therefore we use in maXbox also static binding but in theruntime loading of the script engine.You can use either c++ or Structured Exception Handling

in the DLL. For best results, exceptions should be caughtwithin the scope of the DLL throwing the exception. If thecalling application is built with Borland c++, Delphi or MSc++, the exception can be caught in the application callingthe DLL. However, VB does not seem to have an exceptionhandling syntax. O.k. enough of technical grabbing let'schose the second function calledGetProcessMemoryInfo() to glue it with the firstfunction, hope you remember, OpenProcess() together. Inthe end we put those 2 DLL functions in our scriptfunction!

expertstarter

The const PROCESS_QUERY_INFORMATION retrievescertain information about a process, such as its token, exitcode, and priority class and the other const

This as an overview:We started with OpenProcess from kernel32.dll

5Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Page 6: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 6/24

By Rik Smit

Raize Components is a user interface designsystem for Borland Delphi and BorlandC++Builder. At its center is a collection of morethan 125 general-purpose native VCL controls.Built on a foundation of technology first created

more than eight years ago, these high-qualitycomponents give developers unsurpassed powerand flexibility without sacrificing ease-of-use.In addition to the core set of controls, RaizeComponents includes more than 100 componentdesigners focused on simplifying user interfacedevelopment. Now more than ever, developers useRaize Components to build sophisticated userinterfaces in less time with less effort.

expertstarter Delphi XE and later

Installation is very simple; after unzipping RC6.zip youstart RC6.exe. The installation procedure follows a numberof steps, one of them is the selection menu to select theDelphi version for which you want the components to be

installed (Figure 1).

I’ve chosen for Delphi XE4, but you can also makecombinations of various different versions.After the last ok everything goes automatically. WhenDelphi is then started, you’ll see that the components areloaded during start-up (Figure 2) and eventually you’ll find

them at the bottom part of the Component Palette (Figure3). So everything is done for you. Because it’s ratherlaborious to get this group on top of the Palette (if youprefer that) Raize supplied a program that does this job foryou. Run it and you’re done!.

Raize Components Version 6

Figure 1: Make a selection for the Delphi version involved

Figure 3: The Component Palette with the 7

additional Raize component groups

In the Component Paletteshown in Figure 3 you seethat 7 Raize groups areadded: Raize Panels (17),Raize Edits (25), RaizeLists (19 of which 4 DBrelated), Raize Buttons (16of which 2 DB related),Raize Display (27), Raize

Shell (11), and RaizeWidgets (16).

So all together more than120 components: Toomany to mention them all,so examine the screenshotsof the folded out groups inFigure 4 to get an ideawhat it is all about.

14 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

Page 7: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 7/24

21Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Page 8: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 8/24

22 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS20 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4

COMPONENTS

DEVELOPERS30 Nr 4 / 2013 BLAISE PASCAL MAGAZINE

The license is nowfree for students!

Smart Mobile Studio now offers a free educational licence for students inschool or university or who are members of an after-school coding club.

www.SmartMobileStudio.com

2.01

Page 9: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 9/24

Great news for SMART: Create your own controls

In the world of Delphi there are two archetypal

programmers: Those that stick to the high levelinterface of Delphi, meaning that they only use pre-

made controls and rarely go beneath the bonnet – and

the second group which create components, packages

and love to fiddle around with low-level coding. Thistype of stereotyping is something more or less unique to

RAD languages (which would include Delphi, Lazarus,Visual Basic, Real Basic and languages that are “design”

based). In more mature languages like C++, Delphi

(yes Delphi is just as low level as the C++) or C# low-level work is almost unavoidable.

With Smart Mobile Studio we have tried to retain

much of the high level abstraction you would expectfrom Delphi, but sadly the HTML5 platform is not as

feature rich as the windows API. So the system

demands that if you want something unique, you haveto create your own controls in order to stand out. If not,

you might as well go with the many template-based

 “app machines” out there that produce programs that alllook and feel the same.

The basics of a controlThere are two types of controls you can create underOP4JS: Graphical controls and ordinary parent/childcontrols (like you are used to from Delphi). A graphicalcontrol is an object that contains a HTML5 graphics contextand canvas, which means you have to draw it yourself.This is good for things like games, charts or anything thatcant be represented using “normal” html.

The second type, which is the one 90% of all the standardcontrols that ship with Smart Mobile Studio derive from, is

TW3CustomControl. So let’s have a look at how setting upa fancy iPhone header looks like:

type

Class

 private

Procedure Override

Procedure overrideProcedure override

Procedure overrideEnd 

TW3HeaderControl TW3CustomControl

FLabel TW3Label

FBackBtn TW3ToolButton

FNextBtn TW3ToolButton

Resize

InitializeObjectFinalizeObject

StyleTagObject

 = ( )

  : ;

  : ;

  : ;

  ; ;

  ; ;  ; ;

  ; ;;

Protected 

 protected 

Under Delphi you would probably expect to see aconstructor and destructor in the above code, but underOP4JS we try to synchronize the number of steps taken toestablish a control (i.e number of resize and positionoperations). So to solve this we have introduced 3 newmethods: InitializeObject, FinalizeObject and StyleTagObject.As the names imply you create any sub-controls andinitialize your variables in InitializeObject (just think of it asyour constructor), you destroy those instances inFinalizeObject, and you apply any extra styling or property

alteration in the StyleTagObject method.

Clever stylingWhen a control is in the state of creation, it automaticallyset it’s own style class (think html here) to the name of it’sclass. So in order to give our little control a nice look – weedit the default style sheet (this is automatically createdwhen you create a new application) and make it look like atrue iPhone header. The rule of thumb is: The name of theCSS class always matches the name of the OP4JS control:.

  - :- - ( ,, ,

  ( ),

  - ( , ),  - ( , ),  - ( , ),  - ( , ),  ( ));

  - :

TW3HeaderControl

background image webkit gradient linear left

top left bottom

from

color stopcolor stop

color stop

color stop

border top px s

#b2bbca

#a7b0c3#909cb3

#8593ac

#7c8ba5

#73839f

0.250.5

0.5

0.75

1

to

Adding behaviorIf you don’t know anything about CSS or HTML, don’tworry, you can always copy a style you like from thedefault skin, and there are plenty of examples around theInternet to learn from (or just get a good book, that wouldsave you a lot of time). OK now we need to add some codeto our unit to make it come alive:

Procedure

Begininherited 

end 

ProcedureBegin

if thenif theninherited 

end 

ProcedureBegin

inherited end 

  . ;

  ;  := . ( );  . := ;

;

  . ;

  . ;  ( ) . ;  ( ) . ;  ;

  . ;

  ;;;

TW3HeaderControl InitializeObject

FLabel TW3Label Create self

FLabel BorderStyle bsDotted

TW3HeaderControl FinalizeObject

FLabel free

a ssi gn ed FBa ck Btn F Ba ckB tn fr ee

a ssi gn ed FNe xt Btn F Ne xtB tn fr ee

TW3HeaderControl StyleTagObject

StyleTagObject

24 Nr 1 / 2014 BLAISE PASCAL MAGAZINE

expertstarter

Smart versie 2.01

Page 10: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 10/24

Procedurevar

Begin

ifand thenBegin

end 

if and thenBegin

end 

end 

  . ;

  , : ; : ;  : ;

  := ; := ;  := ; := ;  ( , );

( , );

( )  ( . )

( , . );  ( , ); 

( , . );  ( , ); 

. := ;  . := ;  ;

  ( ) ( . ) 

( , . );  ( , );

  . := ;  . := ;  ;

  . := ;

  . := ;

  . := ;

  . := - ;

;

TW3HeaderControl Resize

wd hd Integer mTemp Integerdx Integer

wd Width hd HeightmTemp wd dx

dec mTemp

dec mTemp

assigned FBackBtnFBackBtn Visible

dec mTemp FBackBtn widthdec mTemp

inc dx FBackBtn Widthinc dx

FBackBtn LeftFBackBtn Top

assigned FNextBtn FNextBtn Visible

dec mTemp FNextBtn widthdec mTemp

FNextBtn Left mTempFNextBtn Top

FLabel left dx

FLabel top

FLabel Width mTemp

FLabel Height Height

444

2

2

44

2

4

4

8

//left margin//Right margin

 //space between "back" & label

 //offset the left edge of the label

 // position the back-button

 //space between label & "next" button

Why all that code? First of all because a typical iPhoneheader have 3 parts: A back button, a next button and sometext in the middle. The above code checks to see if youactually have created a back or next button and shrinks thetext area accordingly. Let’s see how it looks so far:

That was easy enough

I have set the label to have a dotted frame just to make iteasier to work with, we will of-course remove the frame alltogether later. But now, let’s add some more methods tothe class interface. We want to expose the label object togive the user access to it’s full capabilities (caption, font,background, orientation and all the rest), and we also wantboth back and next buttons. But, we want to keep resourcesto a bare minimum, so we will use the old “need” trick andonly create the buttons when asked for. So the buttons willonly be created when you access them:

TW 3He ade rC ont rol T W3C us tom Con tro l

FLabel TW3LabelFBackBtn TW3ToolButtonFNextBtn TW3ToolButton

ReleaseButtonsNeedBackButtonNeedNextButtongetBackButton TW3ToolButtongetNextButton TW3ToolButton

Resize

InitializeObjectFinalizeObjectStyleTagObject

BackButton TW3ToolButtongetBackButton

NextButton TW3ToolButtongetNextButton

Title TW3Label FLabel

Options TW3HeaderButtonOptions

FOptions setOptions

 = ( )

  : ;  : ;  : ;  ;  ;  ;  : ;  : ;

  ; ;

  ; ;  ; ;  ; ;

  :;

  :;

  : ;

  :

  ;

;

Class

 private

 procedureProcedureProcedurefunctionfunction

Procedure Override

Procedure overrideProcedure overrideProcedure override

 publicProperty read  

Property read  

 property read 

Property

read write

End 

Protected 

 protected 

And the implementation for ournew methods are (this is just a quick example):Procedure

Beginif not thenBegin

end end 

ProcedureBegin

if not thenBegin

end end 

functionBegin

end 

function

Begin

end 

 procedureBeginif thenBegin

 NILend 

if thenBegin

 NILend 

end 

  . ;

 

( )

;  := . ( );  ; ;  ;

;

  . ;

 ( )

;  := . ( );  ; ;  ;

;

. : ;

  ; := ;;

 . : ;

  ; := ;;

  . ;

  ( )

. ;  := ;  ;

  ( )

. ;

  := ;  ;

;

TW3HeaderControl NeedBackButton

assigned FBackBtn

BeginUpdate

FBackBtn TW3ToolButton Create Self

SetReSized EndUpdate

TW3HeaderControl NeedNextButton

assigned FNextbtn

BeginUpdateFNextbtn TW3ToolButton Create Self

SetReSized EndUpdate

TW3HeaderControl getBackButton TW3ToolButton

NeedBackButton result FBackBtn

TW3HeaderControl getNextButton TW3ToolButton

NeedNextButton result FNextBtn

TW3HeaderControl ReleaseButtons

assigned FBackBtn

FBackBtn free

FBackBtn

assigned FBackBtn

FNextBtn free

FNextBtn

 // Create object on the fly if required 

 // Create object on the fly if required 

To use our new control, all we have to write (in our Form’sInitializeObject for instance) is something like:

The final product

FMyCoolHeader TW3HeaderControl Create self

FMyCoolHeader BackButton Caption

FMyCoolHeader BackButton onClick

HandleBackButtonClicked

FMyCoolHeader Title Caption

:= . ( );

. . := ;

. . :=

  ;

. . := ;

'Back'

'My cool header!'

And voila – we have a nifty iPhone header that looks andfeels like the real thing.

25Nr 1 . 2014 BLAISE PASCAL MAGAZINE

Great news for SMART: Create your own controls

Page 11: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 11/24

Step 10: Binding Actions to the View Model.

One of the Delphi features I really like are actions

implemented in TAction and the TActionManager orTActionList. Note I referred to the VCL documentation of

these, but FireMonkey includes implementations of TAction and TActionList and as well.Currently, there is no TActionManager in FireMonkey,

though I hope on the future someone will develop one.

UI modifications part 1: the visual partLet's start with the UI: it will be a whole bunch of

controls, so here is a screenshot

and the list of components:

ActionManager1 TActionManager

IncrementByTwo TAction

MultipyByTwo TAction

Button1 TButton

Button2 TButton

ActionToolBar1 TActionToolBar

ActionMainMenuBar1 TActionMainMenuBar

CanIncrementCountBy2

Boolean GetCanIncrementCountBy2

CanMultiplyCountBy2

Boolean GetCanMultiplyCountBy2

TAppViewModel GetCanIncrementCountBy2Boolean

  Result Count MaximumCount

: ;: ;

: ;: ;: ;

: ;: ;

  :  ;

  :;

  . ():  ;

 := + < ;;

The text you can paste to get these components on your form 

is atbut this is the summary:

1. ActionManager has two actions, bothin the Count category:• Action MultipyByTwo has a Caption of *2• Action IncrementByTwo has a Caption of +2

2. Button1 is bound to action MultipyByTwo3. Button2 is bound to action IncrementByTwo4. ActionToolBar1 binds to ActionToolBar1

and has buttons for both the individual actionsas well as the Count category.

5. ActionMainMenuBar1 binds to ActionToolBar1has menu items for the individual actions.

I also fixed the tab-order, as I'm a keyboard guy.

Add these public properties:

Add these methods (the first two are strict protected, the finaltwo public; in my book all methods are virtual):

https://gist.github.com/jpluimers/8149358

Model additions

 property

read 

 property

read 

function

 begin

end 

1

function

 begin

and end 

 procedure

 beginif not then

raise

end 

 procedure

 beginif not then

raise

end 

  . ():;

 := ( * <= )

( * >= );;

  . ();

 . (

); := + ;

;

  . ();

 . (

); := * ;

TAppViewModel GetCanMultiplyCountBy2

Boolean

Result Count MaximumCount

Count MinimumCount

TAppViewModel IncrementCountBy2

CanIncrementCountBy2

EInvalidOperation Create

Count Count

TAppViewModel MultiplyCountBy2

CanMultiplyCountBy2

EInvalidOperation Create

Count Count

2

2

2

2

'not CanIncrementCountBy2'

'not CanMultiplyCountBy2'

Modify the SetCount method so it notifies about the.

Here we will solve the difference in naming of the actionsin the View Model (IncrementCountBy2 andMultiplyCountBy2) the name of the actions in the View(IncrementByTwo and MultipyByTwo).Of course you could rename either two. But in practice you

will often come along a View or View Model that youcannot modify in one way or the other (or both). And that'swhy Caliburn allows for manual binding with eitherattributes or with code. Let's do attributes first.So add these attributes:

If you compile it as is, you get the dreaded W1025compiler warning:

NotifyOfPropertyChange

NotifyOfPropertyChange

( );( );

 

'CanIncrementCountBy2'

'CanMultiplyCountBy2'

UI modifications part 2: the code

[dcc32 Warning] AppViewForm.pas(24): W1025 Unsupported  language feature: 'custom

attribute'

This is one of the Delphi compiler design issues I do notagree with: when you use an attribute that is not in scope,the compiler generates a warning, but not an error. I'm notsure if custom attribute is related to theTCustomAttribute class.

In order to use these attributes, you need to add the unitDSharp.PresentationModel to the uses clauses in theinterface. BTW: Don't forget to make sure that DSharp.Bindings.VCLControls is the last unit in the

uses list.

Steps in MindScape AppView Step - By - StepContinuation of the article in last double issue Nr 31/32

expertstarter

[ ( , )][ ( , )]

: ;[ ( , )][ ( , )]

: ;

Binding

Binding

IncrementByTwo TAction

Binding

Binding

MultipyByTwo TAction

'OnExecute' '{Binding IncrementCountBy2}''Enabled' '{Binding CanIncrementCountBy2}'

'OnExecute' '{Binding MultiplyCountBy2}''Enabled' '{Binding CanMultiplyCountBy2}'

By Jeroen Pluimers

26 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

Page 12: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 12/24

Niklaus Wirth is the father of Pascal andcontinues to introduce creative innovations in theworld of computer programming. He was born onFebruary 1934 in Winterthur, Switzerland.

He received an electronics engineering degreefrom the Swiss Federal Institute of Technology(ETH) in Zurich in 1959, an M.Sc. from LavalUniversity, Canada, in 1960, and a Ph.D. from theUniversity of California at Berkeley in 1963.

He was Assistant Professor of Computer

Science at Stanford University (1963 - 1967), andthen at the University of Zurich. In 1968 hebecame Professor of Informatics at ETH Zurich.

He spent two sabbatical years at the XeroxPARC in California. Since April 1999 he has beenretired; however he has continued to develop thelatest incarnation of Pascal, named Oberon.He received the Turing Prize in 1984, andsubsequently five honorary doctorates, and haswritten numerous important books.

Niklaus Wirth never designed a computerlanguage for its own sake. Rather he developed anew design to meet a practical need for whichthere was no current solution. Modula and Oberon

were by-products of the designs of theworkstations Lilith (1979) and Ceres (1986). As ateacher he was able to make the language assimple as possible.

He concentrated on the essentials ofprogramming and not on the details of thelanguage and notation. "Good enough software"as introduced by a large software developmentcompany is seldom good enough. It is sad that inmodern times developers are rarely proud of theirwork.

When software is developed for purelycommercial reasons its meaning resides largely inits potential for revenue generation (or costminimization); and remuneration becomesthe principal motivation for writinggood software. The satisfactions ofelegance, creativity, didacticpotential, of crafting somethingbeautiful are lost.

Interview With Professor Dr WirthNeither the police nor the University in Zurich wouldrelease contact details, and so Max came up with a namewhich he knew from earlier days – Mr Cuno Pfister, aformer student of Professor Wirth who was involved withOberon and might be able to help us…And he was able tohelp. We found his address and got the opportunity tomake contact with the Professor and ask him for aninterview. Such a great opportunity to meet one of the mostimportant people for the development of software duringthe 20th century.

Professor Wirth simply answered “Yes!”! and that'show the event started: I began to consider what gift I couldtake and found out that he would celebrate his 80thbirthday soon.

It would become quite an experience: I found a hand-bookbinder who could create a number of books out ofthirty issues of Blaise Pascal Magazine. I was not really

sure whether he would appreciate that, but somethingmore interesting I think would be hard to find - in mymind - and so I organized its making.

We finally agreed to to have an interview and afterthat of course a dinner at a very good restaurant.We had to overcome some trouble in the waiting areawhere there was a lot of noise, so sometimes we missedsome of the conversation and understanding because of thenoise.

Happily the questions were written down by Max andin that way we were able to restore the event. After theinterview we had a gorgeous dinner and talked aboutanything but Pascal. Max showed us the

university where professor Wirth started and we took inmuch of the beauty of Zurich.

We photographed some of Computers he workedwith: including one that on account of its excessive weighthad been moved to more secure foundations in thebasement. That's where it all started.After running through the University – running because ofits vastness – we went to the tower and we were taken up50 floors to the topmost storey overlooking the city, wherethe Restaurant was located.

The journey to Zurich…

In September last year there wasconference in Cologne (Köln) -Germany - where I met Max Kleiner.Max lives in Switzerland. He is theoriginator of maXbox, and a Pascaladdict. I asked him if I might be ableto meet Niklaus Wirth, and so theidea for an interview was born.

35 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

Page 13: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 13/24

29Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

The restaurant called Clouds is at the 52 Floor

Prime Tower Zurich

Interview With Professor Dr Wirth (continuation 1)

Page 14: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 14/24

30 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

The view from inside the Clouds

Interview With Professor Dr Wirth (continuation 2)

Page 15: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 15/24

Key New Features / Benefits

Application Tethering Components  Extend your existing Windows applications to mobile without having to port your

whole Windows application.Pick the features that make sense on mobile and easily interact withyour existing Windows applications.

  Connect your desktop (VCL and FMX) applications and mobile apps  Create mobile companion apps for your VCL applications  Works via Wi-Fi and on your local network. Future versions will support Bluetooth.

Taskbar component  Component for presenting previews of multiple windows

that are selectable in your app with button controls within the previews  Automatic or custom previews  Show progress in the taskbar button for your application  Overlay icons on taskbar buttons

Cloud Service (BaaS) integration with components for Kinvey and Parse  Integrate with leading Backend as a Service providers to add functionality

and platform services to your mobile applications.You get easy access to common services in the cloud without havingto build or maintain the backend services yourself.

  Use push notifications to engage your users on any device or platform

  Access data and object storage in the cloud  User authentication  Builds on the REST client support introduced in XE5  Supports the three most popular BaaS providers – Kinvey and

Parse with a common API component set

New VCL Styles  Give your applications an updated Windows or custom look  Includes a Windows tablet style  Supports Windows 7 and Windows 8  Fully style your applications including menus and borders

VCL sensor components  Sensors are everywhere, even for Windows users with new

Windows tablets like the Surface Pro.Now your Delphi apps can add location, movement and other features.

  Access device sensors from VCL apps running on Windows tablets  Accelerometer, GPS and gyroscope functionality

What's New in RAD Studio XE6

http://www.barnsten.com /Or call: +31 (0)23 542 22 27

43Nr 1 . 2014 BLAISE PASCAL MAGAZINE

Page 16: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 16/24

Key New Features / Benefits

In-app purchase and in-app advertising  Mobile apps are a revenue generating opportunity for application developers.

Now you can monetize your mobile apps by integrating in-app purchasefunctionality and advertising.

  Sell content, functionality, services and subscriptions on iOS and Android  Supports the top ad networks (Google AdMob and Apple iAd)

Create apps for Google Glass  Multi-device application development with Delphi now extends beyond PCs,

tablets and smartphones to wearables. Create Android apps that run onGoogle Glass. New custom style with Google Glass optimized look and resolution

  Google Glass device designer template

Accessibility  Make your applications easier to use for more users,

including those using screen reader software.  New accessibility features for FM desktop applications  Supports JAWS on Windows and VoiceOver on Mac OS X

Quality, performance and stability  Get the best development experience and deliver

the best user experience for your users. Addressed over 2,000 reported issues  Increased overall application runtime performance on all platforms

Build Android apps with C++  Adds Android as a target platform for your apps in addition to Windows,

Mac OS X and iOS. Create apps for Android and iOS with a single C++ codebase  Run apps in the emulator and on ARM based Android devices  Supports multiple versions of Android including 4.4 KitKat

C++ Package Support for 64-bit Windows  Now you can fully port your 32-bit apps including packages to 64-bit  Put components into a shared library (DLL)

Find definition and find references  Find all references to a selected item across your entire project  For C++ on Win64, iOS and Android

Core and database features  Core enhancements throughout the product

Database and FireDAC enhancements, FDMemTableDatabase Explorer for FireDAC

  DirectX 11 headers. Apache C++ supportDataSnap performance and updated wizardsRTL refactoring and enhancementsApache support (WebBroker)FireDAC Informix driver updates

What's New in RAD Studio XE6

http://www.barnsten.com /Or call: +31 (0)23 542 22 27

Page 17: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 17/24

What can you do with RAD Studio XE6?

Get FireDAC high performanceenterprise database connectivity

and make database

app development fun again.

Bind any UI control to other objectsor datasets.

With LiveBindings, every componentis data aware.

Develop multi-tier, enterprise

applications with DataSnap, an

integrated architecture spanning fromdatabase servers to application and

data middleware, to client devices.

Push the envelope of performancewith 64-bit Windows to take

advantage of the latest hardware

and more memory.

Develop apps for Windows, Mac,iOS and Android using the tools

and language you know and trust.

Connect with popular cloud services

with REST as well as BaaS providersfor push notifications, authentication,storage and more!

Where and when:

May 8, 2014 – Antwerpen.If this is the pdf version please click here for the agenda and to register for this event

May 13, 2014 – Utrecht.If this is the pdf version please click here for the agenda and to register for this event

Be one of the first and get your XE6 license now!In addition you will get a FREE Bonus pack including:

- TMS modern Windows UI Pack

- VCL Premium Style Pack

- FireMonkey Preimium Style Pack

Order online or contact us for the best advise.

Join us and see all new great XE6 functionalityduring the Developer Direct LIVE! Events.

http://www.barnsten.com /Or call: +31 (0)23 542 22 27

Page 18: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 18/24

46 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

Variables and operatorsAs any algebra, there are variables, operators andarithmetic rules.A variable is denoted by a single character, like A , B, .....A variable is a situation or proposition and possible valuesare only "true" or "false". Example: A = "the door is open".This is true or not, the door cannot be ajar.

For the purpose of calculations, "false" is given thevalue 0 and "true" has value 1.So, we find ourselves in the binary number system.

There are three basic logical operations: AND , OR,complement.

The AND operator is the dot ( . ) ,for OR it is the plus ( + )The . between variables may be omitted:A.B = AB

A.B = 1 if A=1 and B=1

A+B = 1 if A=1 or B=1 (or both A,B are

1)

In the case of switches, AND is serial , OR is parallelconnection.

Similar to negative numbers, there is a logical negationcalled complement.The complement is normally denoted by a horizontal baron top of the variable. Because this is hard to edit on acomputer screen, here we use a / before the variable that iscomplemented. So /0 = 1 , /1 = 0.

LawsFor AND , OR operations, the commutative law applies:AB = BA

A+B = B+A

also the associative law applies:A(BC) = (AB)C

A+(B+C) =(A+B) + C

There are two distributive laws:1. A(B+C) = AB + AC

2. A+BC = (A+B)(A+C)

The proof if this laws is simple: let the variables take allpossible values and compare the results.Reduction rules are:A + /A = 1

A./A = 0

AA = A

A+A = A

A + AB = A (absorbtion law)

AB + A/B = Aproof:

AB + A/B = A(B + /B) = A.1 = A

The proof follows from the table:

A B / AB) /A + /B / A + B) /A. /B

0 0 1 1 1 1

1 0 1 1 0 0

0 1 1 1 0 0

1 1 0 0 0 0

Using above rules all possible formula's may be reduced totheir most simple form. But programming the laws ofDe Morgan is not simple, as this example illustrates:

/AP + /BP + /CP + ABC = P(/A + /B + /C) +

ABC = P./(ABC) + ABC = P + ABC

Another difficult case is this:AB + /BC + AC = AB + /BC,   the term AC isredundant proof:AC = ABC + A/BC, so

AB + /BC + AC = AB + ABC + /BC + A/BC = AB +

/BC

In 1991 I wrote a program to reduce Boolean algebraformula's but I did not use the laws of De Morgan. So, notall formula's were reduced to the limit. But end 2013 Iinvented a new rule which obsoletes De Morgan. This iswhat happened: When reducing formula's like AB + /BC

sometimes a new term AC showed up.This is not wrong, but AC is redundant, see before.Writing newer versions of my old logic program, I includedlengthy procedures to detect terms like AC and eliminatethem. Also, I included procedures to write /A + /B + /C as/(ABC) and more complex data structures had to be addedas well. But still there remained leaks in the reduction.Than I decided not to search for AC in case of AB + /BCbut to add AC .AC I call a virtual term. AB , /BC I call the parents of AC.A virtual term is called VT hereafter.De trick is, that AC is temporarily added to the reductionproces where it may

•  reduce other terms of the truth tablebe reduced itselfgenerate new VT's from other truth table terms

The result is amazing. Simple data structures and only onereduction procedure remain and all known problems aresolved.

• • 

VT's are printed fat.The new law is : AB + /BC ---> AC

In words: if two terms have one variable complemented(such as B , /B) , than a new term may be added thatcontains all other factors of the terms.Example:AB/CD + CE/F ---> ABE/F

Virtual terms at work

Programming Truth Table reduction

Boolean algebra is a kind of algebra that is used in the

design of digital circuits. Also it is of help in programs as

search engines and logic in general. Boolean algebra isa numeric approach of proposition logic.

There are similarities with set theory.Boolean algebra was invented by the Britishmathematician George Boole (1815 - 1864).

This article describes how my program Logic10 reduces

truth tables by using the rules of Boolean algebra.

Introduction

expertstarter

A + /AB = A + B

proof using distributive law 2A + /AB = (A+/A)(A+B) = 1.(A+B) = A+B

Special are the laws of De Morgan:

/(AB) = /A + /B/(A + B) = /A. /B

By David Dirkse

Page 19: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 19/24

51Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Below, a virtual term is made:

Control:

The Logic10 (Delphi-7) project

All input and output data may be saved, loaded or printed.

There are a form and five units:- unit1 : event procedures, simple editor, load, save and printprocedures.

- xlate unit : procedures for formula translation and truth tablegeneration

- logic unit : data and procedures for truth table reduction- debug unit : originally for testing purposes, later for informationabout the translation and reduction.

- help unit : In-Line help information

To keep control over the step-by-step execution, two variables were added:

#27  is the ESCAPE key code, it ends the translation or scan.

The continueflag is examined at several places in the code.

DBwait controls the pause

#32 is the SPACE key code, which advances the translationor scan to the next step.

The program is paused by a call to DBpause.

var

if then

if then

 procedure begin

if then begin

 while and do

end 

else

end 

  : ; : ;

........= := ;

.......  = := ;

;

 

:= ; 

. ; 

:= ;;

continueflag boolean

DBwait boolean

key continueflag false

key dbwait false

DBpause

continueflag

DBwait true

DBwait continueflag

  application ProcessMessages

DBwait false

{key event}#27

{key event}#32

Reliability

How can we be sure that the output is reliable?That not too much information was removed fromthe truth table? Logic10 offers this certainty. After the scans, acomparison is made between the original formulaand the reduced truth table for all values of thevariables. If results are identical, the finalmessage is preceded by OK : followed by theelapsed time.

This concludes the logic10 description.For details, please refer to the source code.And in case of commercial use, do not f orget adonation. Contact me at www.davdata.nl

Programming Truth Table reduction (Continuation 5 - end)

Page 20: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 20/24

44 Nr 1 / 2014 BLAISE PASCAL MAGAZINE4COMPONENTS

DEVELOPERS

Page 21: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 21/24

53Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Updating Dot Tapper for XE5 and Android

New FMX.Graphics unitA new unit was introduced FMX.Graphics, which means ifyou tried to compile the previous Delphi XE4 version of theapplication code in XE5 you would have got a compileerror. Thankfully, the changes required were only minimal.NOTE: Delphi XE5 includes 32 units that didn't exist inDelphi XE4. This article isn't about the general changesbetween Delphi XE4 and Delphi XE5 releases and only

discusses changes between versions relating to theapplication created.

New in Delphi XE5 is a deprecated message whendisabling the GPU Canvas which is used in the application.When the GPU canvas is disabled under iOS 7 some reallyodd drawing occurs when the keyboard is visible. Thedownside of this is the dots look like they are drawn on aVGA monitor.Under iOS 7, the non GPU canvas display black artifactswhen buttons are pressed, the dots animation from black tored doesn't work and the dot is half black and half red.

The cursor doesn't line up with the edit control.

If you have customised a lot of styles in your application

GPU Canvas

TSubImage deprecated

In this article we continue to enhance the Dot Tapperapplication created last time by upgrading it to compile

under Delphi XE5 (for iOS) and also add Android

support.

Updating to Delphi XE5

Delphi XE5 introduced large changes to FireMonkey toaccommodate supporting Android. Numerous platform

specific classes and units were introduced but once

again a large number of changes were also made toexisting features.

expertstarter

 you would have seen a large occurrence of the objectTSubImage in the style.The TSubImage object was used to render platform specificbackgrounds and images from a common PNG image.TSubImage was never available on the component palette

which has been identified as a bug in QualityCentral andstill unresolved however that isn't important now since ithas been deprecated.TSubImage is backwards compatible with older Delphiversions (back to XE3 where it was introduced) so olderstyles using it will still work.None of the custom styles in the application us TSubImageso the deprecation of TSubImage is not an issue for thisapplication.

The TStyleObject is actually a welcome addition to theFireMonkey styling system. It helps reduce the number of

objects required to form many common features (selectedtext appearance, triggered animations) contained within astyle.The new FMX.Styles.Objects unit is where TStyleObject anda myriad of descendants can be found. If you do a lot ofcustom styling, I recommend you spend some time lookingover the changes introduced by the new classes in this unit.

The recently released Update 2 for Rad Studio XE5introduced support for C++ iOS applications. For manyyears Embarcadero was telling us it wasn't able to releasenew features in an update, and they have finally done it.Well done Embarcadero, there should be lots morethinking like this.

TStyleObject (TSubImage successor)

Mobile Preview style - Update 2 only

By Jeremy North

Page 22: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 22/24

59Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

Introduction to Database Development Part 14:Named FireDAC Connections

· Temporary connections· Private connections· Persistent connectionsWhich type of connection you employ determines how theconnection can be used and the features it offers. Forexample, the temporary connections that I described in thepreceding article are referred to as unnamed connections.These connection definitions cannot be shared, and theycannot be pooled. They are, however, very easy to define ateither runtime or design time, and do not rely on anexternal connection definition file.

Persistent connections can be pooled and theconnection definition can be shared by two or moreapplications. Private connections can also be pooled.Unlike persistent connections, however, they can only bedefined at runtime, and cannot be shared betweenapplications. On the other hand, private connections can beshared by two or more threads within a single applications(which is one situation where a private connection'ssupport for connection pooling can come in handy).In this article I am going to show you how to createpersistent and private connections. These connections arenamed connection, so let me begin by showing you how tocreate named connections.

Creating Named Connections

separately for every application. Most database developershave one, or just a few, databases that they need to use acrossmany applications. For those situations, you can save time bycreating a named connection. This will allow you to easily

add new connections to your future applications with aminimum of configuration.

Most developers use name connections to create persistentconnections, and these connection are those whoseparameters are stored in a connection definition file. Delphiprovides two GUI (graphical user interface) tools formanipulating connection definition files: the FireDACExplorer and the Database Explorer. The following sectionsshow you how to create a named connection using each ofthese tools.Creating Named Connections Using the FireDACExplorer

Creating Named Connections

Using the FireDAC Explorer

How you access the FireDAC Explorer depends on whichversion of Delphi you are using. In some versions of Delphiyou can access the FireDAC Explorer from Delphi's menus.In the most recent versions of Delphi, the FireDACExplorer can be accessed from the Tools menu by selectingTools | FireDAC Explorer.

The FireDAC Explorer is named FDExplorer.exe, and it islocated in Delphi's bin directory (which is 

bydefault in the most recent release).As a result, if you are using an older version of Delphi andthe FireDAC Explorer is not available from Delphi's menu

system, you can use the Tools | Configure Tools menuitem to add a Tools menu item for the FireDAC Explorer.The FireDAC Explorer is shown in Figure 1.

C:\Program

Files (x86)\Embarcadero\Studio\14.0\Bin\

Figure 1. The FireDAC Explorer

expertstarter

By Cary Jensen

In the previous article in this series I discussed creating

FireDAC connections using the FDConnection

component. Connections created using the techniquesI described in that article are referred to as temporary

connections. In all, FireDAC supports three distinct typesof connections. These are:

You use named connections to create private and persistentconnections. While unnamed connections are convenient,using them means that you must configure your connections

Page 23: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 23/24

65Nr 1 . 2014 BLAISE PASCAL MAGAZINE 4COMPONENTS

DEVELOPERS

TkbmFMXVerticalLayout

TkbmFMXImageControl

 is a simple layout that stacks controls added vertically.It autosizes in height to match the contained objects.I will use it in samples bellow.

 is a bitmap viewer withzoom/rotate/pan functionality built in.In addition it allows people to define zones on top of theimage, that can be painted in various colors.

Let's put together some interface to demonstrate this

control. We can drop kbmFMXVerticalLayout on form,some text control on top, and then putkbmFMXImageControl, and three buttons, all onkbmFMXVerticalLayout control. We need also oneActionList component to add standard camera and galleryfunctionalities. At the end, form will look like this:

Figure 1: Then, we add some code to define zones.

The zones are "hotspots" which can be clicked etc.

 procedure

const

 begin

if

then

else

end 

 procedure

const

  var

 begin

if

then begin

if then

end 

end 

  . (

: ;

  : );

  . . = .

. . := .

  . . := . ;

  . . := . ;;

  . (

: ;

  : ;

: );

  . =

:= ;

  ;

;

TfrmImage kbmFMXImageControl1ClickZone

  Sender TObject

AZone TkbmFMXImageZone

AZone Fill Kind TBrushKind bkNone

AZone Fill Kind TBrushKind bkSolid

AZone Fill Kind TBrushKind bkNone

AZone Fill Color TAlphaColorRec Cadetblue

TfrmImage kbmFMXImageControl1Gesture

  Sender TObject

EventInfo TGestureEventInfo

Handled Boolean

EventInfo GestureID igiLongTap

AddZone Handled true

Now, we want to handle LongTap gesture, and we can dothat using following code:

{$IFDEF ANDROID}

{$ENDIF}

function

var

 begin

if then

 begin

0.5

end 

else

end 

  . : ;

: ;

  := . ( );

  ( )

. := . ;

  . . := . ;

  . . := . ;

  . := ;

  := ;

 

:= ;

;

TfrmImage AddZone boolean

z TkbmFMXImageZone

z kbmFMXImageControl1 NewZone true

Assigned z

z Kind TkbmFMXImageZoneKind kbmizkCircle

z Fill Color TAlphaColorRec Green

z Fill Kind TBrushKind bkSolid

z Opacity

Result true

Result false

SIX NEW READY TO USE COMPONENTS !from kbm for Win32/64 OSX/IOS Android

by Fikert Hasovic

Our friends at components4developers arevery busy these days, trying to give us the

best possible experience on mobile platform.There are 6 new components in kbmFMX.

expertstarter

Handling image rotation is very simple, just a single line 

Figure 2: Screenshot from actual device looks like above

kbmFMXImageControl1 DisplayAngle kbmFMXImageControl1 DisplayAngle. := . - ;45

Page 24: Blaise 33

7/25/2019 Blaise 33

http://slidepdf.com/reader/full/blaise-33 24/24

Supports Delphi/C++Builder/RAD Studio 2009 toXE5 (32bit, 64bit and OSX where applicable).

kbmMW for XE5 includes full support for Android

and IOS (client and server).

kbmMemTable is the fastest and most feature rich

in memory table for Embarcadero products.

- Easily supports large datasets

with millions of records- Easy data streaming support

- Optional to use native SQL engine

- Supports nested transactions and undo- Native and fast build in M/D,

aggregation /grouping,

range selection features- Advanced indexing features for extreme

performance

Warning!

kbmMemTable and kbmMWare highly addictive!Once used, and you are hooked for life!

kbmMW v4.50 just about being released!kbmMemTable v. 7.50 available!Supports Delphi/C++Builder/RAD Studio 2009 to XE5 (32bit, 64bit and OSX where applicable).

kbmMW for XE5 includes full support for Android and IOS (client and server).

kbmMW is the premier high performance, high

functionality multi tier product for serious

system development.

- Native high performance 100% developer

defined application server with support for

loadbalancing and failover

- Native high performance JSON and XML

(DOM and SAX) for easy integration withexternal systems

- Native support for RTTI assisted object

marshalling to and from XML/JSON, now also

with new fullfeatured XML schema

(XSD) import

- High speed, unified database access

(35+ supported database APIs) with

connection pooling, metadata and

data caching on all tiers

- Multi head access to the application server,

via AJAX, native binary, Publish/Subscribe,

SOAP, XML, RTMP from web browsers,

embedded devices, linked application

servers, PCs, mobile devices, Java systems

and many more clients

EESB SOA MoM EAI TOOLS FOR INTELLIGENT SOLUTIONS kbmMW IS THE PREMIERE N-TIER PRODUCT FOR DELPHI / C++BUILDER

kbmFMXFormLayout  

kbmFMXPaintBoxkbmFMXMemo

kbmFMXVerticalLayout

kbmFMXNumberInput 

with automatic support for scrolling active control so it will be visible when the keyboard is shown,

and to include a close keyboard button to close it again to do fingerpainting (signatures etc) 

is an extension of the existing memo, bugfix 

shows all its children vertically and autoresizes to fit all children and thus provide vertical scrollif more children are available than can fit on to the screen

which is a numeric input control, that supports formatting like currency etc. while typing

COMPONENTSDEVELOPERS4