day 2 of c++ boot camp - creating fast responsive user interfaces

28
© 2016 Embarcadero Technologies, Inc. All rights reserved. C++ BUILDER BOOT CAMP 8 th to 12 th of August, 2016 More information http://embt.co/2016cbootcamp

Upload: jim-mckeeth

Post on 26-Jan-2017

173 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

C++BUILDER BOOTCAMP8thto12thofAugust,2016

Moreinformationhttp://embt.co/2016cbootcamp

Page 2: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

Day2: CreatingFastResponsiveUserInterfaceswithAwesomeAnimationsandEffects

[email protected]

9th-Aug-2016Moreinfo:http://embt.co/2016cppbootcamp2

Page 3: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

[email protected]

9th-Aug-2016Moreinfohttp://embt.co/2016cppbootcamp2

▪ UserInterfaceConsiderations▪WorkingwithAnimations▪ CreatingEffects▪ AvoidingFreezes▪ DealingwithScreenResolutions▪ CustomizingStylesandAppearance▪ PlanningforMobile

Day2:Agenda

Page 4: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

Day2: CreatingFastResponsiveUserInterfaceswithAwesomeAnimationsandEffects

▪ LeadWorldWideDeveloperEvangelist&Engineer▪ Longtimesoftwaredeveloper▪ Inventedandpatentedpatternandswipetounlock

▪ USPatent#8352745&6766456,etc.▪ BuiltthoughtcontrolleddronewithGoogleGlass▪ HostofPodcastatDelphi.org▪ LivesnearBoise,Idaho,USAwithhisfamily▪ ImprovisationalcomedyperformerwithCSzBoise▪ FollowonTwitter@JimMcKeeth▪ Availableviaemail:[email protected]

AboutJimMcKeeth

9th-Aug-2016More info http://embt.co/2016cppbootcamp2

Page 5: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

USERINTERFACECONSIDERATIONS▪ Layouts▪ Anchors▪ Alignments▪ Padding▪ Spacing▪ TabControl▪ ListViewvs.ListBox▪ Scollables▪ Frames▪ MultiView

FMX Layout Strategies http://embt.co/fmxlayouts

Page 6: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

FIREMONKEY(FMX)BASICS

▪ Anythingcanbenested▪ SeeClipChildren

▪ Mostnumericpropertiesareasingle&animatable▪ Position,RotationCenter,

Scale,Size(Height&Width),Opacity,&RotationAngle

▪ UseMakeScreenshotmethodtogetBitmapoflayout

Page 7: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

ANCHORS

▪ Positionrelativetooneormoreedge(s)ofparent:▪ Top▪ Bottom▪ Left▪ Right

▪ DefaultisTop,Left▪ Moveswithparentresize▪ Eachcontrolhas0to4anchors

▪ DocWiki:http://embt.co/fmxanchors

Page 8: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

ALIGNMENT

▪ Alignscontrolwithinparent,settinganchors,sizeandposition.DefaultisNone.▪ Anchorandfillalongedge▪ Top,Bottom,Left,Right

▪ Fillparent,butpreserveaspectratio▪ Fit,FitLeft,FitRight

▪ Fillalongonesideoftheparent▪ MostBottom,MostTop,MostLeft,MostRight

▪ Resizeonlyononeaxis(widthorheight)▪ Vertical,VertCenter,Horizontal,HorzCenter

▪ Miscellaneous▪ Client,Center,Contents,Scale

▪ DocWiki:http://embt.co/fmxalignlayout

Page 9: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

SPACING–MARGINSANDPADDING

▪ Margins▪ Spacingforsiblings

(andparentedges)▪ http://embt.co/fmxmargins

▪ Padding▪ Spacingforchildren▪ http://embt.co/fmxpadding

Page 10: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TFLOWLAYOUT

▪ Arrangechildcontrolslikewordsinaparagraph▪ Controlsarrangedinorderaddedtolayout▪ UseTFlowLayoutBreakforforcedlinebreak▪ DocWiki:http://embt.co/tflowlayout

Page 11: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TGRIDLAYOUT

▪ Arrangeschildcontrolsinagridofequalsizes▪ Controlsflowthroughgridasparentresizes▪ UseItemWidthandItemHeightproperties▪ Customizemarginsofindividualcontrols

▪ DocWiki:http://embt.co/tgridlayout

Page 12: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TGRIDPANELLAYOUT

▪ Createsagridofspecifiedrowsandcolumns▪ Doesnotchangetheanchororsizeofchild▪ Eachcellcancontain1childcontrol▪ YousettheHeight,Width,Align,andAnchorsofchildren

▪ Controlscanspanmultiplecells

▪ DocWiki:http://embt.co/tgridpanellayout

Page 13: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TSCALEDLAYOUT

▪ Stretcheschildcontrolsasitisresizedatruntime▪ Doesn’trespectaspectratiosofcontrols▪ SettheAlignoftheTScaledLayouttoFittomaintainaspectratio▪ DocWiki:http://embt.co/tscaledlayout

Page 14: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TSCROLLBOX

▪ Allowschildrentotakeupmorespacethanparent▪ UsuallyanchoredtoClient▪ OnlyanchorchildrentoTop&Left(default)▪ Scrolltoseeadditionalchildren▪ Seealso:▪ TVertScrollBox,THorzScrollBox,TFramedScrollBox

andTFramedVertScrollBox▪ DocWiki:http://embt.co/tscrollbox

Page 15: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TTABCONTROL

▪ Controltogroupchildcontrolsintotabs▪ Tabsareinastackwithonevisibleatatime.▪ TabPosition:=PlatformDefaultto

useplatformdefaultbehavior.▪ TabPosition:=Nonetohide

navigation.▪ UseTTabChangeActiontoanimate

transitions.▪ DocWiki:http://embt.co/usingttabcontrol

Page 16: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TMULTIVIEW

▪ Onesuperpanelwithmultiplemodes▪ Supportedmodes

▪ PlatformDefault▪ Drawer▪ NavigationPane▪ Panel▪ Popover▪ Custom

▪ PointtoMasterPane,DetailPaneanddefinableMasterButton

▪ PlatformDefaultadaptstoplatformandorientation(formobile)▪ Customsupportsuserdefinedlayoutandbehavior▪ DocWiki:http://embt.co/usingmultiview

Page 17: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

FRAMES

▪ ReusablepiecesofUserInterface▪ Thelayoutandalltheeventhandlers▪ Allthecodeintheunit

▪ Create1ormoreFramesinproject,thenreusethemindifferentlayoutsorindifferentplaces

▪ DocWiki: http://embt.co/workingwithframes

hips://commons.wikimedia.org/wiki/File:Oil_painkng_frame_Wellcome_L0067855.jpg

Page 18: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

ANIMATIONS

▪ Modifypropertyvaluesoverduration▪ Automaticormanualstart▪ Optionaldelay,loop,inverse,etc.▪ Triggers(orTrueorFalse)▪ IsMouseOver,IsDragOver,IsFocused,IsVisible,

IsPressed,IsChecked,IsSelected,IsExpanded▪ EventsOnProcess&OnFinish▪ Note:Multipleanimationinstancesarenot

necessarilysynchronized(noticeableovertime).

http://embt.co/animation-effects

Page 19: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

INTERPOLATION

▪ Determineshowtherateofthevaluechangestotheovertime.▪ Linearisdefaultandchangesataconstantrate.▪ Alloptions:Linear,Quadratic,Cubic,Quartic,Quintic,Sinusoidal,

Exponential,Circular,Elastic,Back,&Bounce▪ AnimationTypecontrolshowInterpolationisapplied(startvs.end)▪ In-Thecurveappliestothestartingvalueofthepropertyanimated.▪ Out-Thecurveappliestotheendingvalueofthepropertyanimated

andproceedsbackwardstothestartingvalue.▪ InOut-Thecurveappliestotheboththestartingvalueandthe

endingvalueofthepropertyanimatedandmeetsatthecenterpoint.

http://embt.co/interpolation-type

Page 20: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

EFFECTS

▪ Over40GPUpoweredeffects(notcountingtransitioneffects)

▪ Builtusingshaderfilters▪ Progresspropertyrepresents

precentageofapplication(canbeanimatedovertime)

▪ Supportsoptionaltriggerforautomaticenableordisable

▪ Applytoimageorcontrol

http://embt.co/fmx-effects

Page 21: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

TRANSITIONEFFECTS

▪ Over20TransitionEffects▪ AsubsetofregularEffects▪ Changesparentimage(orcontrol)into

targetimage▪ Progresspropertyrepresentspercentage

ofapplication(canbeanimatedovertime)▪ Forcontroltransitionsuse

MakeScreenshottogetTargetimage

http://embt.co/fmx-effects

Page 22: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

AVOIDINGFREEZES

▪ Don’trunprocessesinthemainUIthread▪ UseTTask&TFuturefromthePPL▪ ThePPLmanagesathreadpool▪ TTaskisaunitofwork▪ http://embt.co/UsingTTask

▪ TFutureisavalueneededlater▪ http://embt.co/UsingIFuture

▪ UseTThread.QueuetoupdateUI▪ http://embt.co/TThreadQueue

▪ MoreonPPL▪ http://embt.co/UsingPPL

Page 23: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

STYLES

▪ UseTStyleBooktoloadstyle▪ Defaultstyleisplatformdefault▪ Canoverridestyle▪ Optionallycustomizestyle▪ http://embt.co/fmxstyles

Page 24: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

[email protected]

9th-Aug-2016Moreinfohttp://embt.co/2016cppbootcamp2

▪ UserInterfaceConsiderations▪WorkingwithAnimations▪ CreatingEffects▪ AvoidingFreezes▪ DealingwithScreenResolutions▪ CustomizingStylesandAppearance▪ PlanningforMobile

Day2:Agenda

Page 25: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

[email protected]

DAY3: C++11LANGUAGEDEEPDIVE

Page 26: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

DAY4: C++GAMEDEVELOPMENTEliM.

MoreInformationhttp://embt.co/CppGames2016

Page 27: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

DAY5: STEPPINGUPTOMOBILE

[email protected]

&JimMcKeeth

[email protected]

Page 28: Day 2 of C++ Boot Camp - Creating Fast Responsive User Interfaces

© 2016 Embarcadero Technologies, Inc. All rights reserved.

Q&AJoinusatCommunity.Embarcadero.com

[email protected]/cppbuilder/

[email protected]

9th-Aug-2016Moreinfo:http://embt.co/2016cppbootcamp2