├── 10 ├── AutoRTTI │ ├── AutoRTTI.dpr │ ├── AutoRTTI.dproj │ ├── AutoRTTI.res │ ├── AutoRTTIForm.fmx │ └── AutoRTTIForm.pas ├── Chapter10.groupproj ├── DateComponent │ ├── DateCompGroup.groupproj │ ├── DateCompTest.dpr │ ├── DateCompTest.dproj │ ├── DateCompTest.res │ ├── DateCompTestForm.fmx │ ├── DateCompTestForm.pas │ ├── DateComponent.pas │ ├── DatePackage.dpk │ ├── DatePackage.dproj │ └── DatePackage.res ├── DynamicEvents │ ├── DynamicEvents.dpr │ ├── DynamicEvents.dproj │ ├── DynamicEvents.res │ ├── DynamicEventsForm.fmx │ └── DynamicEventsForm.pas ├── FormProperties │ ├── FormProperties.dpr │ ├── FormProperties.dproj │ ├── FormProperties.res │ ├── FormPropertiesForm.fmx │ └── FormPropertiesForm.pas ├── NumbersEnumerator │ ├── NumbersEnumerator.dpr │ ├── NumbersEnumerator.dproj │ ├── NumbersEnumerator.res │ ├── NumbersEnumerator_MainForm.fmx │ └── NumbersEnumerator_MainForm.pas └── VarProp │ ├── VarProp.dpr │ ├── VarProp.dproj │ ├── VarProp.res │ ├── VarPropForm.fmx │ └── VarPropForm.pas ├── 11 ├── AdapterIntf_VCL │ ├── Adapter_Demo.dpr │ ├── Adapter_Demo.dproj │ ├── Adapter_Demo.res │ ├── IEdit.pas │ ├── ILabel.pas │ ├── IProgressBar.pas │ ├── adapter_intf.pas │ ├── mainform.dfm │ └── mainform.pas ├── Chapter11.groupproj ├── Intf101 │ ├── InterfaceForm.fmx │ ├── InterfaceForm.pas │ ├── Intf101.dpr │ ├── Intf101.dproj │ └── Intf101.res ├── IntfDemo │ ├── InterfaceForm.fmx │ ├── InterfaceForm.pas │ ├── IntfDemo.dpr │ ├── IntfDemo.dproj │ └── IntfDemo.res ├── IntfError │ ├── InterfaceForm.fmx │ ├── InterfaceForm.pas │ ├── IntfError.dpr │ ├── IntfError.dproj │ └── IntfError.res └── ObjFromIntf_VCL │ ├── ObjFromIntf.dpr │ ├── ObjFromIntf.dproj │ ├── ObjFromIntf.res │ ├── ObjFromIntfMainForm.dfm │ └── ObjFromIntfMainForm.pas ├── 12 ├── Chapter12.groupproj ├── ClassCtor_VCL │ ├── ClassCtor.dpr │ ├── ClassCtor.dproj │ ├── ClassCtor.res │ ├── ClassCtorMainForm.dfm │ └── ClassCtorMainForm.pas ├── ClassHelpers_VCL │ ├── Classhelpers.dpr │ ├── Classhelpers.dproj │ ├── Classhelpers.res │ ├── ClasshelpersForm.dfm │ └── ClasshelpersForm.pas ├── ClassRef │ ├── ClassRef.dpr │ ├── ClassRef.dproj │ ├── ClassRef.res │ ├── ClassRefForm.fmx │ └── ClassRefForm.pas ├── ClassStatic_VCL │ ├── ClassStatic.dpr │ ├── ClassStatic.dproj │ └── ClassStatic.res ├── ControlHelper │ ├── ControlHelper.dpr │ ├── ControlHelper.dproj │ ├── ControlHelper.res │ ├── HelperForm.fmx │ └── HelperForm.pas ├── RecordHelpers_VCL │ ├── RecordHelpers.dpr │ ├── RecordHelpers.dproj │ ├── RecordHelpers.res │ ├── RecordHelpers_MainForm.dfm │ └── RecordHelpers_MainForm.pas ├── StaticCallBack_VCL │ ├── CallBackForm.dfm │ ├── CallBackForm.pas │ ├── StaticCallBack.dpr │ ├── StaticCallBack.dproj │ └── StaticCallBack.res └── TypeAliasHelper │ ├── HelperForm.fmx │ ├── HelperForm.pas │ ├── TypeAliasHelper.dpr │ ├── TypeAliasHelper.dproj │ └── TypeAliasHelper.res ├── 13 ├── ArcExperiments │ ├── ArcExperiments.dpr │ ├── ArcExperiments.dproj │ ├── ArcExperiments.res │ ├── ArcExperiments_MainForm.fmx │ ├── ArcExperiments_MainForm.pas │ └── Arc_MoreClasses.pas ├── Chapter13.groupproj ├── FastMMCode_VCL │ ├── FastMM4.pas │ ├── FastMM4Messages.pas │ ├── FastMM4Options.inc │ ├── FastMMCode.dpr │ ├── FastMMCode.dproj │ ├── FastMMCode.drc │ ├── FastMMCode.res │ ├── FastMMForm.dfm │ └── FastMMForm.pas ├── LeakTest_VCL │ ├── LeakTest.dpr │ ├── LeakTest.dproj │ ├── LeakTest.res │ ├── LeakTestForm.dfm │ └── LeakTestForm.pas ├── SafeCode_VCL │ ├── CantuMMan.pas │ ├── CantuMemTest.pas │ ├── SafeCode.dpr │ ├── SafeCode.dproj │ ├── SafeCode.res │ ├── SafeCodeMain.dfm │ └── SafeCodeMain.pas └── ShowMemory │ ├── ShowMemory.dpr │ ├── ShowMemory.dproj │ ├── ShowMemory.res │ ├── ShowMemoryForm.fmx │ └── ShowMemoryForm.pas ├── 14 ├── Chapter14.groupproj ├── ClassConstraint_VCL │ ├── ClassConstraint.dpr │ ├── ClassConstraint.dproj │ ├── ClassConstraint.res │ ├── ClassConstraint_MainForm.dfm │ └── ClassConstraint_MainForm.pas ├── CovariantReturnTypes_VCL │ ├── Covariant.dpr │ ├── Covariant.dproj │ ├── Covariant.res │ ├── Covariant_MainForm.dfm │ └── Covariant_MainForm.pas ├── CustomerDictionary_VCL │ ├── CustomerClasses.pas │ ├── CustomerDataModule.dfm │ ├── CustomerDataModule.pas │ ├── CustomerDictionary.dpr │ ├── CustomerDictionary.dproj │ ├── CustomerDictionary.res │ ├── CustomerDictionary_MainForm.dfm │ ├── CustomerDictionary_MainForm.pas │ └── customer.cds ├── GenericClassCtor_VCL │ ├── GenericClassCtor.dpr │ ├── GenericClassCtor.dproj │ ├── GenericClassCtor.res │ ├── GenericClassCtor_Classes.pas │ ├── GenericClassCtor_MainForm.dfm │ └── GenericClassCtor_MainForm.pas ├── GenericInterface_VCL │ ├── GenericInterface.dpr │ ├── GenericInterface.dproj │ ├── GenericInterface.res │ ├── GenericInterface_MainForm.dfm │ └── GenericInterface_MainForm.pas ├── GenericMethod │ ├── GenericForm.fmx │ ├── GenericForm.pas │ ├── GenericMethod.dpr │ ├── GenericMethod.dproj │ └── GenericMethod.res ├── GenericTypeFunc_VCL │ ├── GenericTypeFunc.dpr │ ├── GenericTypeFunc.dproj │ ├── GenericTypeFunc.res │ ├── GenericTypeFunc_MainForm.dfm │ └── GenericTypeFunc_MainForm.pas ├── IntfConstraint_VCL │ ├── IntfConstraint.dpr │ ├── IntfConstraint.dproj │ ├── IntfConstraint.res │ ├── IntfConstraint_MainForm.dfm │ └── IntfConstraint_MainForm.pas ├── KeyValueClassic_VCL │ ├── KeyValueClassic.dpr │ ├── KeyValueClassic.dproj │ ├── KeyValueClassic.res │ ├── KeyValueCode.pas │ ├── KeyValueForm.dfm │ └── KeyValueForm.pas ├── KeyValueGeneric_VCL │ ├── KeyValueCode.pas │ ├── KeyValueForm.dfm │ ├── KeyValueForm.pas │ ├── KeyValueGeneric.dpr │ ├── KeyValueGeneric.dproj │ └── KeyValueGeneric.res ├── ListDemoMD2005_VCL │ ├── Dates.pas │ ├── ListDemoMd2005.dpr │ ├── ListDemoMd2005.dproj │ ├── ListDemoMd2005.res │ ├── ListForm.dfm │ └── ListForm.pas ├── SmartPointers_VCL │ ├── SmartPointerClass.pas │ ├── SmartPointers.dpr │ ├── SmartPointers.dproj │ ├── SmartPointers.res │ ├── SmartPointers_MainForm.dfm │ └── SmartPointers_MainForm.pas ├── StringListVsDictionary_VCL │ ├── ListDictionary_MainForm.dfm │ ├── ListDictionary_MainForm.pas │ ├── StringListVsDictionary.dpr │ ├── StringListVsDictionary.dproj │ └── StringListVsDictionary.res └── TypeCompRules_VCL │ ├── TypeCompRules.dpr │ ├── TypeCompRules.dproj │ ├── TypeCompRules.res │ ├── TypeCompRules_MainForm.dfm │ ├── TypeCompRules_MainForm.pas │ └── TypeCompRules_OtherUnit.pas ├── 15 ├── AnonAjax_VCL │ ├── AnonAjax.dpr │ ├── AnonAjax.dproj │ ├── AnonAjax.res │ ├── AnonAjax_MainForm.dfm │ ├── AnonAjax_MainForm.pas │ └── AnonAjax_Thread.pas ├── AnonButton │ ├── AnonButton.dpr │ ├── AnonButton.dproj │ ├── AnonButton.res │ ├── AnonButtonForm.fmx │ └── AnonButtonForm.pas ├── AnonLargeString │ ├── AnonLargeString.dpr │ ├── AnonLargeString.dproj │ ├── AnonLargeString.res │ ├── LargeStringForm.fmx │ └── LargeStringForm.pas ├── AnonymFirst_VCL │ ├── AnonymFirst.dpr │ ├── AnonymFirst.dproj │ ├── AnonymFirst.res │ ├── AnonymFirst_MainForm.dfm │ └── AnonymFirst_MainForm.pas ├── Chapter15.groupproj └── WebFind_VCL │ ├── FindTh.pas │ ├── WebFind.dpr │ ├── WebFind.dproj │ ├── WebFind.res │ ├── WebFindF.dfm │ └── WebFindF.pas ├── 16 ├── Chapter16.groupproj ├── DescriptionAttribute_VCL │ ├── DescriptionAttribute.dpr │ ├── DescriptionAttribute.dproj │ ├── DescriptionAttribute.res │ ├── DescriptionAttribute_Classes.pas │ ├── DescriptionAttribute_MainForm.dfm │ └── DescriptionAttribute_MainForm.pas ├── InterceptBaseClass_VCL │ ├── InterceptBaseClass.dpr │ ├── InterceptBaseClass.dproj │ ├── InterceptBaseClass.res │ ├── InterceptBaseClass_MainForm.dfm │ └── InterceptBaseClass_MainForm.pas ├── RttiAccess │ ├── RttiAccess.dpr │ ├── RttiAccess.dproj │ ├── RttiAccess.res │ ├── RttiForm.fmx │ └── RttiForm.pas ├── RttiAttrib_VCL │ ├── RttiAttrib.dpr │ ├── RttiAttrib.dproj │ ├── RttiAttrib.res │ ├── RttiAttribMainForm.dfm │ └── RttiAttribMainForm.pas ├── RttiIntro_VCL │ ├── RttiIntro.dpr │ ├── RttiIntro.dproj │ ├── RttiIntro.res │ ├── RttiIntro_MainForm.dfm │ └── RttiIntro_MainForm.pas ├── TValueTest_VCL │ ├── TValueTest.dpr │ ├── TValueTest.dproj │ ├── TValueTest.res │ ├── TValueTestMainForm.dfm │ └── TValueTestMainForm.pas ├── TypesList │ ├── TypeInfoForm.fmx │ ├── TypeInfoForm.pas │ ├── TypesForm.fmx │ ├── TypesForm.pas │ ├── TypesList.dpr │ ├── TypesList.dproj │ └── TypesList.res └── XmlPersist_VCL │ ├── TrivialXmlWriter.pas │ ├── XmlPersist.dpr │ ├── XmlPersist.dproj │ ├── XmlPersist.res │ ├── XmlPersistAttrib_Classes.pas │ ├── XmlPersistPublish_Classes.pas │ ├── XmlPersistRtti_Classes.pas │ ├── XmlPersist_MainForm.dfm │ └── XmlPersist_MainForm.pas ├── 17 ├── Chapter17.groupproj └── SystemObject_VCL │ ├── SystemObject.dpr │ ├── SystemObject.dproj │ ├── SystemObject.res │ ├── SystemObject_MainForm.dfm │ └── SystemObject_MainForm.pas ├── 18 ├── BinaryFiles_VCL │ ├── BinaryFiles.dpr │ ├── BinaryFiles.dproj │ ├── BinaryFiles.res │ ├── BinaryFiles_MainForm.dfm │ └── BinaryFiles_MainForm.pas ├── Chapter18.groupproj ├── IoFilesInFolder_VCL │ ├── IoFilesInFolder.dpr │ ├── IoFilesInFolder.dproj │ ├── IoFilesInFolder.res │ ├── IoFilesInFolderMainForm.dfm │ └── IoFilesInFolderMainForm.pas ├── ReaderWriter_VCL │ ├── ReaderWriter.dpr │ ├── ReaderWriter.dproj │ ├── ReaderWriter.res │ ├── ReaderWriter_MainForm.dfm │ ├── ReaderWriter_MainForm.pas │ └── test.txt └── StringBuilderDemo_VCL │ ├── StringBuilderDemo.dpr │ ├── StringBuilderDemo.dproj │ ├── StringBuilderDemo.res │ ├── StringBuilderDemo_MainForm.dfm │ └── StringBuilderDemo_MainForm.pas ├── .gitignore ├── 01 ├── Chapter01.groupproj ├── HelloConsole │ ├── HelloConsole.dpr │ ├── HelloConsole.dproj │ └── HelloConsole.res ├── HelloPlatform │ ├── HelloPlatform.dpr │ ├── HelloPlatform.dproj │ ├── HelloPlatform.res │ ├── HelloPlatformForm.fmx │ └── HelloPlatformForm.pas ├── HelloVisual │ ├── HelloVisual.dpr │ ├── HelloVisual.dproj │ ├── HelloVisual.res │ ├── HelloVisualForm.fmx │ └── HelloVisualForm.pas └── IdentifiersTest │ ├── IdentifiersTest.dpr │ ├── IdentifiersTest.dproj │ ├── IdentifiersTest.res │ ├── IdentifiersTestForm.fmx │ └── IdentifiersTestForm.pas ├── 02 ├── Chapter02.groupproj ├── CharsTest │ ├── CharsTest.dpr │ ├── CharsTest.dproj │ ├── CharsTest.res │ ├── CharsTestForm.fmx │ └── CharsTestForm.pas ├── ExpressionsTest │ ├── ExpressionsTest.dpr │ ├── ExpressionsTest.dproj │ ├── ExpressionsTest.res │ ├── ExpressionsTestForm.fmx │ └── ExpressionsTestForm.pas ├── FloatTest │ ├── FloatTest.dpr │ ├── FloatTest.dproj │ ├── FloatTest.res │ ├── FloatTestForm.fmx │ └── FloatTestForm.pas ├── IntegersTest │ ├── IntegersTest.dpr │ ├── IntegersTest.dproj │ ├── IntegersTest.res │ ├── IntegersTestForm.fmx │ └── IntegersTestForm.pas ├── TimeNow │ ├── TimeNow.dpr │ ├── TimeNow.dproj │ ├── TimeNow.res │ ├── TimeNowForm.fmx │ └── TimeNowForm.pas └── VariablesTest │ ├── VariablesTest.dpr │ ├── VariablesTest.dproj │ ├── VariablesTest.res │ ├── VariablesTestForm.fmx │ └── VariablesTestForm.pas ├── 03 ├── CaseTest │ ├── CaseTest.dpr │ ├── CaseTest.dproj │ ├── CaseTest.res │ ├── CaseTestForm.fmx │ └── CaseTestForm.pas ├── Chapter03.groupproj ├── FlowTest │ ├── FlowTest.dpr │ ├── FlowTest.dproj │ ├── FlowTest.res │ ├── FlowTestForm.fmx │ └── FlowTestForm.pas ├── ForTest │ ├── ForTest.dpr │ ├── ForTest.dproj │ ├── ForTest.res │ ├── ForTestForm.fmx │ └── ForTestForm.pas ├── IfTest │ ├── IfTest.dpr │ ├── IfTest.dproj │ ├── IfTest.res │ ├── IfTestForm.fmx │ └── IfTestForm.pas └── LoopsTest │ ├── LoopsTest.dpr │ ├── LoopsTest.dproj │ ├── LoopsTest.res │ ├── LoopsTestForm.fmx │ └── LoopsTestForm.pas ├── 04 ├── Chapter04.groupproj ├── FunctionTest │ ├── FunctionTest.dpr │ ├── FunctionTest.dproj │ ├── FunctionTest.res │ ├── FunctionTestForm.fmx │ └── FunctionTestForm.pas ├── InliningTest │ ├── InliningTest.dpr │ ├── InliningTest.dproj │ ├── InliningTest.res │ ├── InliningTestForm.fmx │ └── InliningTestForm.pas ├── OverloadTest │ ├── OverloadTest.dpr │ ├── OverloadTest.dproj │ ├── OverloadTest.res │ ├── OverloadTestForm.fmx │ └── OverloadTestForm.pas ├── ParamsTest │ ├── ParamsTest.dpr │ ├── ParamsTest.dproj │ ├── ParamsTest.res │ ├── ParamsTestForm.fmx │ └── ParamsTestForm.pas └── ProcType │ ├── ProcType.dpr │ ├── ProcType.dproj │ ├── ProcType.res │ ├── ProcTypeForm.fmx │ └── ProcTypeForm.pas ├── 05 ├── AlignTest │ ├── AlignTest.dpr │ ├── AlignTest.dproj │ ├── AlignTest.res │ ├── AlignTestForm.fmx │ └── AlignTestForm.pas ├── ArraysTest │ ├── ArraysTest.dpr │ ├── ArraysTest.dproj │ ├── ArraysTest.res │ ├── ArraysTestForm.fmx │ └── ArraysTestForm.pas ├── Chapter05.groupproj ├── DynArray │ ├── DynArray.dpr │ ├── DynArray.dproj │ ├── DynArray.res │ ├── DynArrayForm.fmx │ └── DynArrayForm.pas ├── OpenArray │ ├── OpenArray.dpr │ ├── OpenArray.dproj │ ├── OpenArray.res │ ├── OpenArrayForm.fmx │ └── OpenArrayForm.pas ├── OperatorsOver │ ├── OperatorsOver.dpr │ ├── OperatorsOver.dproj │ ├── OperatorsOver.res │ ├── OperatorsOverForm.fmx │ ├── OperatorsOverForm.pas │ └── OperatorsTypes.pas ├── PointersTest │ ├── PointersTest.dpr │ ├── PointersTest.dproj │ ├── PointersTest.res │ ├── PointersTestForm.fmx │ └── PointersTestForm.pas ├── RecordMethods │ ├── RecordMethods.dpr │ ├── RecordMethods.dproj │ ├── RecordMethods.res │ ├── RecordMethodsForm.fmx │ └── RecordMethodsForm.pas ├── RecordsTest │ ├── RecordsTest.dpr │ ├── RecordsTest.dproj │ ├── RecordsTest.res │ ├── RecordsTestForm.fmx │ └── RecordsTestForm.pas ├── RecordsWith │ ├── RecordsWith.dpr │ ├── RecordsWith.dproj │ ├── RecordsWith.res │ ├── RecordsWithForm.fmx │ └── RecordsWithForm.pas └── VariantTest │ ├── VariantTest.dpr │ ├── VariantTest.dproj │ ├── VariantTest.res │ ├── VariantTestForm.fmx │ └── VariantTestForm.pas ├── 06 ├── Chapter06.groupproj ├── CharTest │ ├── CharTest.dpr │ ├── CharTest.dproj │ ├── CharTest.res │ ├── CharTestForm.fmx │ └── CharTestForm.pas ├── CodePoints │ ├── CodePoints.dpr │ ├── CodePoints.dproj │ ├── CodePoints.res │ ├── CodePointsForm.fmx │ └── CodePointsForm.pas ├── EncodingsTest │ ├── EncodingsTest.dpr │ ├── EncodingsTest.dproj │ ├── EncodingsTest.res │ ├── EncodingsTestForm.fmx │ └── EncodingsTestForm.pas ├── FormatString │ ├── FormatString.dpr │ ├── FormatString.dproj │ ├── FormatString.res │ ├── FormatStringForm.fmx │ └── FormatStringForm.pas ├── LargeString │ ├── LargeString.dpr │ ├── LargeString.dproj │ ├── LargeString.res │ ├── LargeStringForm.fmx │ └── LargeStringForm.pas ├── ShowUnicode │ ├── ShowUnicode.dpr │ ├── ShowUnicode.dproj │ ├── ShowUnicode.res │ ├── ShowUnicodeForm.fmx │ └── ShowUnicodeForm.pas ├── StringHelperTest │ ├── StringHelperForm.fmx │ ├── StringHelperForm.pas │ ├── StringHelperTest.dpr │ ├── StringHelperTest.dproj │ └── StringHelperTest.res ├── StringMetaTest │ ├── StringMetaTest.dpr │ ├── StringMetaTest.dproj │ ├── StringMetaTest.res │ ├── StringMetaTestForm.fmx │ └── StringMetaTestForm.pas └── Strings101 │ ├── Strings101.dpr │ ├── Strings101.dproj │ ├── Strings101.res │ ├── Strings101Form.fmx │ └── Strings101Form.pas ├── 07 ├── Chapter07.groupproj ├── ClicksCount │ ├── ClicksCount.dpr │ ├── ClicksCount.dproj │ ├── ClicksCount.res │ ├── ClicksCountForm.fmx │ └── ClicksCountForm.pas ├── CreateComps │ ├── CreateComps.dpr │ ├── CreateComps.dproj │ ├── CreateComps.res │ ├── CreateCompsForm.fmx │ └── CreateCompsForm.pas ├── Dates1 │ ├── Dates1.dpr │ ├── Dates1.dproj │ ├── Dates1.res │ ├── DatesForm.fmx │ └── DatesForm.pas ├── Dates2 │ ├── Dates2.dpr │ ├── Dates2.dproj │ ├── Dates2.res │ ├── DatesForm.fmx │ └── DatesForm.pas ├── Dates3 │ ├── Dates3.dpr │ ├── Dates3.dproj │ ├── Dates3.res │ ├── DatesForm.fmx │ └── DatesForm.pas ├── Dates4 │ ├── Dates4.dpr │ ├── Dates4.dproj │ ├── Dates4.res │ ├── DatesForm.fmx │ └── DatesForm.pas ├── NestedTypes │ ├── NestedClass.pas │ ├── NestedTypes.dpr │ ├── NestedTypes.dproj │ ├── NestedTypes.res │ ├── NestedTypesForm.fmx │ └── NestedTypesForm.pas └── ViewDates │ ├── Dates.pas │ ├── ViewDates.dpr │ ├── ViewDates.dproj │ ├── ViewDates.res │ ├── ViewDatesForm.fmx │ └── ViewDatesForm.pas ├── 08 ├── Animals1 │ ├── Animals1.dpr │ ├── Animals1.dproj │ ├── Animals1.res │ ├── AnimalsClasses.pas │ ├── AnimalsForm.fmx │ └── AnimalsForm.pas ├── Animals2 │ ├── Animals2.dpr │ ├── Animals2.dproj │ ├── Animals2.res │ ├── AnimalsClasses.pas │ ├── AnimalsForm.fmx │ ├── AnimalsForm.pas │ ├── animalvoice.wav │ └── arfarf.wav ├── Animals3 │ ├── Animals3.dpr │ ├── Animals3.dproj │ ├── Animals3.res │ ├── AnimalsClasses.pas │ ├── AnimalsForm.fmx │ ├── AnimalsForm.pas │ ├── animalvoice.wav │ ├── arfarf.wav │ └── mieow.wav ├── Chapter08.groupproj ├── DerivedDates │ ├── Dates.pas │ ├── DerivedDates.dpr │ ├── DerivedDates.dproj │ ├── DerivedDates.res │ ├── ViewDatesForm.fmx │ └── ViewDatesForm.pas ├── Protection │ ├── Protection.dpr │ ├── Protection.dproj │ ├── Protection.res │ ├── ProtectionForm.fmx │ ├── ProtectionForm.pas │ └── TestClass.pas ├── ReintroduceTest │ ├── ReintroduceForm.fmx │ ├── ReintroduceForm.pas │ ├── ReintroduceTest.dpr │ ├── ReintroduceTest.dproj │ └── ReintroduceTest.res └── VirtualInheritTest │ ├── Unit1.fmx │ ├── Unit1.pas │ ├── Unit2.fmx │ ├── Unit2.pas │ ├── VirtualInheritTest.dpr │ ├── VirtualInheritTest.dproj │ └── VirtualInheritTest.res ├── 09 ├── AdvancedExcept │ ├── AdvancedExcept.dpr │ ├── AdvancedExcept.dproj │ ├── AdvancedExcept.res │ ├── ExceptionForm.fmx │ └── ExceptionForm.pas ├── Chapter09.groupproj ├── ConstructorExcept │ ├── ConstructorExcept.dpr │ ├── ConstructorExcept.dproj │ ├── ConstructorExcept.res │ ├── ExceptionForm.fmx │ └── ExceptionForm.pas ├── ErrorLog │ ├── ErrorLog.dpr │ ├── ErrorLog.dproj │ ├── ErrorLog.res │ ├── ExceptionForm.fmx │ └── ExceptionForm.pas ├── ExceptionFinally │ ├── ExceptFinally.dpr │ ├── ExceptFinally.dproj │ ├── ExceptFinally.res │ ├── ExceptionForm.fmx │ └── ExceptionForm.pas ├── ExceptionFlow │ ├── ExceptionFlow.dpr │ ├── ExceptionFlow.dproj │ ├── ExceptionFlow.res │ ├── ExceptionForm.fmx │ └── ExceptionForm.pas └── ExceptionTest │ ├── ExceptionForm.fmx │ ├── ExceptionForm.pas │ ├── ExceptionTest.dpr │ ├── ExceptionTest.dproj │ └── ExceptionTest.res └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.stat -------------------------------------------------------------------------------- /01/HelloConsole/HelloConsole.dpr: -------------------------------------------------------------------------------- 1 | program HelloConsole; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | var 6 | strMessage: string; 7 | 8 | begin 9 | strMessage := 'Hello, World'; 10 | writeln (strMessage); 11 | // wait until the Enter key is pressed 12 | readln; 13 | end. 14 | -------------------------------------------------------------------------------- /01/HelloConsole/HelloConsole.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/01/HelloConsole/HelloConsole.res -------------------------------------------------------------------------------- /01/HelloPlatform/HelloPlatform.dpr: -------------------------------------------------------------------------------- 1 | program HelloPlatform; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | HelloPlatformForm in 'HelloPlatformForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /01/HelloPlatform/HelloPlatform.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/01/HelloPlatform/HelloPlatform.res -------------------------------------------------------------------------------- /01/HelloPlatform/HelloPlatformForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Position.X = 32.000000000000000000 13 | Position.Y = 24.000000000000000000 14 | Size.Width = 305.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Platform' 19 | OnClick = Button1Click 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /01/HelloPlatform/HelloPlatformForm.pas: -------------------------------------------------------------------------------- 1 | unit HelloPlatformForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Controls.Presentation; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Button1: TButton; 13 | procedure Button1Click(Sender: TObject); 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | end; 19 | 20 | var 21 | Form1: TForm1; 22 | 23 | implementation 24 | 25 | {$R *.fmx} 26 | 27 | procedure TForm1.Button1Click(Sender: TObject); 28 | begin 29 | {$IFDEF IOS} 30 | ShowMessage ('Running on iOS'); 31 | {$ENDIF} 32 | 33 | {$IFDEF ANDROID} 34 | ShowMessage ('Running on Android'); 35 | {$ENDIF} 36 | 37 | {$IFDEF MSWINDOWS} 38 | ShowMessage ('Running on Windows'); 39 | {$ENDIF} 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /01/HelloVisual/HelloVisual.dpr: -------------------------------------------------------------------------------- 1 | program HelloVisual; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | HelloVisualForm in 'HelloVisualForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /01/HelloVisual/HelloVisual.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/01/HelloVisual/HelloVisual.res -------------------------------------------------------------------------------- /01/HelloVisual/HelloVisualForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Position.X = 72.000000000000000000 13 | Position.Y = 48.000000000000000000 14 | Size.Width = 233.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Button1' 19 | OnClick = Button1Click 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /01/HelloVisual/HelloVisualForm.pas: -------------------------------------------------------------------------------- 1 | unit HelloVisualForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Controls.Presentation; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Button1: TButton; 13 | procedure Button1Click(Sender: TObject); 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | end; 19 | 20 | var 21 | Form1: TForm1; 22 | 23 | implementation 24 | 25 | {$R *.fmx} 26 | 27 | procedure TForm1.Button1Click(Sender: TObject); 28 | var 29 | strMessage: string; 30 | begin 31 | strMessage := 'Hello, World'; 32 | ShowMessage (strMessage); 33 | end; 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /01/IdentifiersTest/IdentifiersTest.dpr: -------------------------------------------------------------------------------- 1 | program IdentifiersTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | IdentifiersTestForm in 'IdentifiersTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /01/IdentifiersTest/IdentifiersTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/01/IdentifiersTest/IdentifiersTest.res -------------------------------------------------------------------------------- /01/IdentifiersTest/IdentifiersTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | end 12 | -------------------------------------------------------------------------------- /01/IdentifiersTest/IdentifiersTestForm.pas: -------------------------------------------------------------------------------- 1 | unit IdentifiersTestForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs; 8 | 9 | type 10 | TForm1 = class(TForm) 11 | private 12 | { Private declarations } 13 | public 14 | { Public declarations } 15 | end; 16 | 17 | var 18 | Form1: TForm1; 19 | 20 | // classic identifiers 21 | MyValue: Integer; 22 | Value1: Integer; 23 | My_Value: Integer; 24 | _Value: Integer; 25 | Val123: Integer; 26 | _123: Integer; 27 | Cantu: Integer; 28 | 29 | // valid unicode identifiers 30 | Cantù: Integer; 31 | 结: Integer; 32 | 画像: Integer; 33 | ☼: Integer; 34 | ⒈5: Integer; 35 | 36 | // invalid identifiers 37 | // 123: Integer; 38 | // 1Value: Integer; 39 | // My Value: Integer; 40 | // My-Value: Integer; 41 | // My%Value: Integer; 42 | 43 | 44 | implementation 45 | 46 | {$R *.fmx} 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /02/CharsTest/CharsTest.dpr: -------------------------------------------------------------------------------- 1 | program CharsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | CharsTestForm in 'CharsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/CharsTest/CharsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/CharsTest/CharsTest.res -------------------------------------------------------------------------------- /02/CharsTest/CharsTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Position.X = 24.000000000000000000 15 | Position.Y = 192.000000000000000000 16 | Size.Width = 353.000000000000000000 17 | Size.Height = 329.000000000000000000 18 | Size.PlatformDefault = False 19 | TabOrder = 0 20 | Viewport.Width = 345.000000000000000000 21 | Viewport.Height = 321.000000000000000000 22 | end 23 | object Button1: TButton 24 | Position.X = 24.000000000000000000 25 | Position.Y = 16.000000000000000000 26 | Size.Width = 321.000000000000000000 27 | Size.Height = 44.000000000000000000 28 | Size.PlatformDefault = False 29 | TabOrder = 1 30 | Text = 'Char Helper' 31 | OnClick = Button1Click 32 | end 33 | object Button2: TButton 34 | Position.X = 24.000000000000000000 35 | Position.Y = 80.000000000000000000 36 | Size.Width = 321.000000000000000000 37 | Size.Height = 44.000000000000000000 38 | Size.PlatformDefault = False 39 | TabOrder = 2 40 | Text = 'Ordinal Char Functions' 41 | OnClick = Button2Click 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /02/CharsTest/CharsTestForm.pas: -------------------------------------------------------------------------------- 1 | unit CharsTestForm; 2 | 3 | interface 4 | 5 | // running this program raises an exception by design 6 | 7 | uses 8 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 9 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 10 | FMX.Layouts, FMX.Memo, FMX.Controls.Presentation, FMX.ScrollBox; 11 | 12 | type 13 | TForm1 = class(TForm) 14 | Memo1: TMemo; 15 | Button1: TButton; 16 | Button2: TButton; 17 | procedure Button1Click(Sender: TObject); 18 | procedure Button2Click(Sender: TObject); 19 | private 20 | { Private declarations } 21 | public 22 | procedure Show (const msg: string); 23 | end; 24 | 25 | var 26 | Form1: TForm1; 27 | 28 | implementation 29 | 30 | {$R *.fmx} 31 | 32 | uses 33 | Character; 34 | 35 | procedure TForm1.Button1Click(Sender: TObject); 36 | var 37 | ch: Char; 38 | begin 39 | ch := 'a'; 40 | Show (BoolToStr(ch.IsLetter, True)); 41 | Show (ch.ToUpper); 42 | end; 43 | 44 | procedure TForm1.Button2Click(Sender: TObject); 45 | var 46 | ch: Char; 47 | str1: string; 48 | begin 49 | ch := 'a'; 50 | Show (ch); 51 | Inc (ch, 100); 52 | Show (ch); 53 | 54 | str1 := ''; 55 | for ch := #32 to #1024 do 56 | str1 := str1 + ch; 57 | Show (str1) 58 | end; 59 | 60 | procedure TForm1.Show(const msg: string); 61 | begin 62 | Memo1.Lines.Add(msg); 63 | end; 64 | 65 | end. 66 | -------------------------------------------------------------------------------- /02/ExpressionsTest/ExpressionsTest.dpr: -------------------------------------------------------------------------------- 1 | program ExpressionsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExpressionsTestForm in 'ExpressionsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/ExpressionsTest/ExpressionsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/ExpressionsTest/ExpressionsTest.res -------------------------------------------------------------------------------- /02/ExpressionsTest/ExpressionsTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'expressions' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /02/ExpressionsTest/ExpressionsTestForm.pas: -------------------------------------------------------------------------------- 1 | unit ExpressionsTestForm; 2 | 3 | interface 4 | 5 | // running this program raises an exception by design 6 | 7 | uses 8 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 9 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 10 | FMX.Layouts, FMX.Memo, FMX.Controls.Presentation, FMX.ScrollBox; 11 | 12 | type 13 | TForm1 = class(TForm) 14 | Memo1: TMemo; 15 | Button1: TButton; 16 | procedure Button1Click(Sender: TObject); 17 | private 18 | { Private declarations } 19 | public 20 | procedure Show (const msg: string); 21 | end; 22 | 23 | var 24 | Form1: TForm1; 25 | 26 | implementation 27 | 28 | {$R *.fmx} 29 | 30 | procedure TForm1.Button1Click(Sender: TObject); 31 | begin 32 | Show (IntToStr (20 * 5)); 33 | Show (IntToStr (30 + 222)); 34 | Show (BoolToStr (3 < 30, True)); 35 | Show (BoolToStr (12 = 10, True)); 36 | end; 37 | 38 | procedure TForm1.Show(const msg: string); 39 | begin 40 | Memo1.Lines.Add(msg); 41 | end; 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /02/FloatTest/FloatTest.dpr: -------------------------------------------------------------------------------- 1 | program FloatTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | FloatTestForm in 'FloatTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/FloatTest/FloatTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/FloatTest/FloatTest.res -------------------------------------------------------------------------------- /02/FloatTest/FloatTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Position.X = 32.000000000000000000 15 | Position.Y = 144.000000000000000000 16 | Size.Width = 313.000000000000000000 17 | Size.Height = 329.000000000000000000 18 | Size.PlatformDefault = False 19 | TabOrder = 0 20 | Viewport.Width = 305.000000000000000000 21 | Viewport.Height = 321.000000000000000000 22 | end 23 | object Button1: TButton 24 | Position.X = 24.000000000000000000 25 | Position.Y = 16.000000000000000000 26 | Size.Width = 321.000000000000000000 27 | Size.Height = 44.000000000000000000 28 | Size.PlatformDefault = False 29 | TabOrder = 1 30 | Text = 'Single Precision' 31 | OnClick = Button1Click 32 | end 33 | object Button2: TButton 34 | Position.X = 24.000000000000000000 35 | Position.Y = 80.000000000000000000 36 | Size.Width = 321.000000000000000000 37 | Size.Height = 44.000000000000000000 38 | Size.PlatformDefault = False 39 | TabOrder = 2 40 | Text = 'Double Precision' 41 | OnClick = Button2Click 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /02/FloatTest/FloatTestForm.pas: -------------------------------------------------------------------------------- 1 | unit FloatTestForm; 2 | 3 | interface 4 | 5 | // running this program raises an exception by design 6 | 7 | uses 8 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 9 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 10 | FMX.Layouts, FMX.Memo, FMX.Controls.Presentation, FMX.ScrollBox; 11 | 12 | type 13 | TForm1 = class(TForm) 14 | Memo1: TMemo; 15 | Button1: TButton; 16 | Button2: TButton; 17 | procedure Button1Click(Sender: TObject); 18 | procedure Button2Click(Sender: TObject); 19 | private 20 | { Private declarations } 21 | public 22 | procedure Show (const msg: string); 23 | end; 24 | 25 | var 26 | Form1: TForm1; 27 | 28 | implementation 29 | 30 | {$R *.fmx} 31 | 32 | uses 33 | Character; 34 | 35 | procedure TForm1.Button1Click(Sender: TObject); 36 | var 37 | s1: Single; 38 | begin 39 | s1 := 0.5 * 0.2; 40 | Show (s1.ToString); 41 | end; 42 | 43 | procedure TForm1.Button2Click(Sender: TObject); 44 | var 45 | d1: Double; 46 | begin 47 | d1 := 0.5 * 0.2; 48 | Show (d1.ToString); 49 | end; 50 | 51 | procedure TForm1.Show(const msg: string); 52 | begin 53 | Memo1.Lines.Add(msg); 54 | end; 55 | 56 | end. 57 | -------------------------------------------------------------------------------- /02/IntegersTest/IntegersTest.dpr: -------------------------------------------------------------------------------- 1 | program IntegersTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | IntegersTestForm in 'IntegersTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/IntegersTest/IntegersTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/IntegersTest/IntegersTest.res -------------------------------------------------------------------------------- /02/IntegersTest/IntegersTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Position.X = 24.000000000000000000 15 | Position.Y = 192.000000000000000000 16 | Size.Width = 353.000000000000000000 17 | Size.Height = 329.000000000000000000 18 | Size.PlatformDefault = False 19 | TabOrder = 0 20 | Viewport.Width = 345.000000000000000000 21 | Viewport.Height = 321.000000000000000000 22 | end 23 | object Button1: TButton 24 | Position.X = 24.000000000000000000 25 | Position.Y = 16.000000000000000000 26 | Size.Width = 321.000000000000000000 27 | Size.Height = 44.000000000000000000 28 | Size.PlatformDefault = False 29 | TabOrder = 1 30 | Text = 'Integer Helper' 31 | OnClick = Button1Click 32 | end 33 | object Button2: TButton 34 | Position.X = 24.000000000000000000 35 | Position.Y = 80.000000000000000000 36 | Size.Width = 321.000000000000000000 37 | Size.Height = 44.000000000000000000 38 | Size.PlatformDefault = False 39 | TabOrder = 2 40 | Text = 'Ordinal Functions' 41 | OnClick = Button2Click 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /02/TimeNow/TimeNow.dpr: -------------------------------------------------------------------------------- 1 | program TimeNow; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | TimeNowForm in 'TimeNowForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/TimeNow/TimeNow.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/TimeNow/TimeNow.res -------------------------------------------------------------------------------- /02/TimeNow/TimeNowForm.pas: -------------------------------------------------------------------------------- 1 | unit TimeNowForm; 2 | 3 | interface 4 | 5 | // running this program raises an exception by design 6 | 7 | uses 8 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 9 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 10 | FMX.Layouts, FMX.Memo, FMX.Controls.Presentation, FMX.ScrollBox; 11 | 12 | type 13 | TForm1 = class(TForm) 14 | Memo1: TMemo; 15 | Button1: TButton; 16 | Button2: TButton; 17 | Timer1: TTimer; 18 | procedure Button1Click(Sender: TObject); 19 | procedure Button2Click(Sender: TObject); 20 | procedure Timer1Timer(Sender: TObject); 21 | private 22 | { Private declarations } 23 | public 24 | procedure Show (const msg: string); 25 | end; 26 | 27 | var 28 | Form1: TForm1; 29 | 30 | implementation 31 | 32 | {$R *.fmx} 33 | 34 | procedure TForm1.Button1Click(Sender: TObject); 35 | var 36 | StartTime: TDateTime; 37 | begin 38 | StartTime := Now; 39 | Show ('Time is ' + TimeToStr (StartTime)); 40 | Show ('Date is ' + DateToStr (StartTime)); 41 | end; 42 | 43 | procedure TForm1.Button2Click(Sender: TObject); 44 | begin 45 | Timer1.Enabled := True; 46 | end; 47 | 48 | procedure TForm1.Show(const msg: string); 49 | begin 50 | Memo1.Lines.Add(msg); 51 | end; 52 | 53 | procedure TForm1.Timer1Timer(Sender: TObject); 54 | begin 55 | Show ('Time is ' + TimeToStr (Now)); 56 | end; 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /02/VariablesTest/VariablesTest.dpr: -------------------------------------------------------------------------------- 1 | program VariablesTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | VariablesTestForm in 'VariablesTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /02/VariablesTest/VariablesTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/02/VariablesTest/VariablesTest.res -------------------------------------------------------------------------------- /02/VariablesTest/VariablesTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Position.X = 40.000000000000000000 13 | Position.Y = 96.000000000000000000 14 | Size.Width = 297.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Undefined' 19 | OnClick = Button1Click 20 | end 21 | object Button2: TButton 22 | Position.X = 40.000000000000000000 23 | Position.Y = 32.000000000000000000 24 | Size.Width = 297.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Assignments' 29 | OnClick = Button2Click 30 | end 31 | object Button3: TButton 32 | Position.X = 48.000000000000000000 33 | Position.Y = 168.000000000000000000 34 | Size.Width = 281.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'Resource String' 39 | OnClick = Button3Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /03/CaseTest/CaseTest.dpr: -------------------------------------------------------------------------------- 1 | program CaseTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | CaseTestForm in 'CaseTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /03/CaseTest/CaseTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/03/CaseTest/CaseTest.res -------------------------------------------------------------------------------- /03/FlowTest/FlowTest.dpr: -------------------------------------------------------------------------------- 1 | program FlowTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | FlowTestForm in 'FlowTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /03/FlowTest/FlowTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/03/FlowTest/FlowTest.res -------------------------------------------------------------------------------- /03/ForTest/ForTest.dpr: -------------------------------------------------------------------------------- 1 | program ForTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ForTestForm in 'ForTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /03/ForTest/ForTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/03/ForTest/ForTest.res -------------------------------------------------------------------------------- /03/IfTest/IfTest.dpr: -------------------------------------------------------------------------------- 1 | program IfTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | IfTestForm in 'IfTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /03/IfTest/IfTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/03/IfTest/IfTest.res -------------------------------------------------------------------------------- /03/LoopsTest/LoopsTest.dpr: -------------------------------------------------------------------------------- 1 | program LoopsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | LoopsTestForm in 'LoopsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /03/LoopsTest/LoopsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/03/LoopsTest/LoopsTest.res -------------------------------------------------------------------------------- /04/FunctionTest/FunctionTest.dpr: -------------------------------------------------------------------------------- 1 | program FunctionTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | FunctionTestForm in 'FunctionTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /04/FunctionTest/FunctionTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/04/FunctionTest/FunctionTest.res -------------------------------------------------------------------------------- /04/InliningTest/InliningTest.dpr: -------------------------------------------------------------------------------- 1 | program InliningTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | InliningTestForm in 'InliningTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /04/InliningTest/InliningTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/04/InliningTest/InliningTest.res -------------------------------------------------------------------------------- /04/OverloadTest/OverloadTest.dpr: -------------------------------------------------------------------------------- 1 | program OverloadTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | OverloadTestForm in 'OverloadTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /04/OverloadTest/OverloadTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/04/OverloadTest/OverloadTest.res -------------------------------------------------------------------------------- /04/ParamsTest/ParamsTest.dpr: -------------------------------------------------------------------------------- 1 | program ParamsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ParamsTestForm in 'ParamsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /04/ParamsTest/ParamsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/04/ParamsTest/ParamsTest.res -------------------------------------------------------------------------------- /04/ParamsTest/ParamsTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'call CharInString' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'call DoubleTheValue (var)' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /04/ProcType/ProcType.dpr: -------------------------------------------------------------------------------- 1 | program ProcType; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ProcTypeForm in 'ProcTypeForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /04/ProcType/ProcType.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/04/ProcType/ProcType.res -------------------------------------------------------------------------------- /04/ProcType/ProcTypeForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 500.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 492.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Call Proc' 29 | OnClick = Button1Click 30 | end 31 | object CheckBox1: TCheckBox 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 23.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'Triple' 39 | OnChange = CheckBox1Change 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /05/AlignTest/AlignTest.dpr: -------------------------------------------------------------------------------- 1 | program AlignTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AlignTestForm in 'AlignTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/AlignTest/AlignTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/AlignTest/AlignTest.res -------------------------------------------------------------------------------- /05/AlignTest/AlignTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Align Test' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /05/ArraysTest/ArraysTest.dpr: -------------------------------------------------------------------------------- 1 | program ArraysTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ArraysTestForm in 'ArraysTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/ArraysTest/ArraysTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/ArraysTest/ArraysTest.res -------------------------------------------------------------------------------- /05/DynArray/DynArray.dpr: -------------------------------------------------------------------------------- 1 | program DynArray; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DynArrayForm in 'DynArrayForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/DynArray/DynArray.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/DynArray/DynArray.res -------------------------------------------------------------------------------- /05/OpenArray/OpenArray.dpr: -------------------------------------------------------------------------------- 1 | program OpenArray; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | OpenArrayForm in 'OpenArrayForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/OpenArray/OpenArray.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/OpenArray/OpenArray.res -------------------------------------------------------------------------------- /05/OperatorsOver/OperatorsOver.dpr: -------------------------------------------------------------------------------- 1 | program OperatorsOver; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | OperatorsOverForm in 'OperatorsOverForm.pas' {Form1}, 8 | OperatorsTypes in 'OperatorsTypes.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /05/OperatorsOver/OperatorsOver.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/OperatorsOver/OperatorsOver.res -------------------------------------------------------------------------------- /05/PointersTest/PointersTest.dpr: -------------------------------------------------------------------------------- 1 | program PointersTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | PointersTestForm in 'PointersTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/PointersTest/PointersTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/PointersTest/PointersTest.res -------------------------------------------------------------------------------- /05/RecordMethods/RecordMethods.dpr: -------------------------------------------------------------------------------- 1 | program RecordMethods; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | RecordMethodsForm in 'RecordMethodsForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/RecordMethods/RecordMethods.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/RecordMethods/RecordMethods.res -------------------------------------------------------------------------------- /05/RecordsTest/RecordsTest.dpr: -------------------------------------------------------------------------------- 1 | program RecordsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | RecordsTestForm in 'RecordsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/RecordsTest/RecordsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/RecordsTest/RecordsTest.res -------------------------------------------------------------------------------- /05/RecordsWith/RecordsWith.dpr: -------------------------------------------------------------------------------- 1 | program RecordsWith; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | RecordsWithForm in 'RecordsWithForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/RecordsWith/RecordsWith.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/RecordsWith/RecordsWith.res -------------------------------------------------------------------------------- /05/RecordsWith/RecordsWithForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'With Record' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'With Error' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /05/VariantTest/VariantTest.dpr: -------------------------------------------------------------------------------- 1 | program VariantTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | VariantTestForm in 'VariantTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /05/VariantTest/VariantTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/05/VariantTest/VariantTest.res -------------------------------------------------------------------------------- /05/VariantTest/VariantTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Variant Test' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'Speed Test' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /06/CharTest/CharTest.dpr: -------------------------------------------------------------------------------- 1 | program CharTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | CharTestForm in 'CharTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/CharTest/CharTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/CharTest/CharTest.res -------------------------------------------------------------------------------- /06/CharTest/CharTestForm.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/CharTest/CharTestForm.pas -------------------------------------------------------------------------------- /06/CodePoints/CodePoints.dpr: -------------------------------------------------------------------------------- 1 | program CodePoints; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | CodePointsForm in 'CodePointsForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/CodePoints/CodePoints.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/CodePoints/CodePoints.res -------------------------------------------------------------------------------- /06/CodePoints/CodePointsForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object Button1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Grapheme' 26 | OnClick = Button1Click 27 | end 28 | object Button2: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Surrogate' 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /06/CodePoints/CodePointsForm.pas: -------------------------------------------------------------------------------- 1 | unit CodePointsForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Memo1: TMemo; 13 | Button1: TButton; 14 | Button2: TButton; 15 | procedure Button1Click(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | procedure Show (const msg: string); 20 | end; 21 | 22 | var 23 | Form1: TForm1; 24 | 25 | implementation 26 | 27 | {$R *.fmx} 28 | 29 | 30 | procedure TForm1.Button1Click(Sender: TObject); 31 | var 32 | S1: String; 33 | begin 34 | S1 := #$0061 + #$0300; 35 | ShowMessage (S1); 36 | end; 37 | 38 | procedure TForm1.Show(const Msg: string); 39 | begin 40 | Memo1.Lines.Add(Msg); 41 | end; 42 | 43 | end. 44 | -------------------------------------------------------------------------------- /06/EncodingsTest/EncodingsTest.dpr: -------------------------------------------------------------------------------- 1 | program EncodingsTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | EncodingsTestForm in 'EncodingsTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/EncodingsTest/EncodingsTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/EncodingsTest/EncodingsTest.res -------------------------------------------------------------------------------- /06/EncodingsTest/EncodingsTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Convert Utf-8 String' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'Utf8 Processing' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /06/EncodingsTest/EncodingsTestForm.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/EncodingsTest/EncodingsTestForm.pas -------------------------------------------------------------------------------- /06/FormatString/FormatString.dpr: -------------------------------------------------------------------------------- 1 | program FormatString; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | FormatStringForm in 'FormatStringForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/FormatString/FormatString.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/FormatString/FormatString.res -------------------------------------------------------------------------------- /06/LargeString/LargeString.dpr: -------------------------------------------------------------------------------- 1 | program LargeString; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | LargeStringForm in 'LargeStringForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/LargeString/LargeString.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/LargeString/LargeString.res -------------------------------------------------------------------------------- /06/LargeString/LargeStringForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Concatenate' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'StringBuilder' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /06/ShowUnicode/ShowUnicode.dpr: -------------------------------------------------------------------------------- 1 | program ShowUnicode; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ShowUnicodeForm in 'ShowUnicodeForm.pas' {Form2}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm2, Form2); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/ShowUnicode/ShowUnicode.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/ShowUnicode/ShowUnicode.res -------------------------------------------------------------------------------- /06/StringHelperTest/StringHelperForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Find' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'Replace' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /06/StringHelperTest/StringHelperTest.dpr: -------------------------------------------------------------------------------- 1 | program StringHelperTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | StringHelperForm in 'StringHelperForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/StringHelperTest/StringHelperTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/StringHelperTest/StringHelperTest.res -------------------------------------------------------------------------------- /06/StringMetaTest/StringMetaTest.dpr: -------------------------------------------------------------------------------- 1 | program StringMetaTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | StringMetaTestForm in 'StringMetaTestForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/StringMetaTest/StringMetaTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/StringMetaTest/StringMetaTest.res -------------------------------------------------------------------------------- /06/StringMetaTest/StringMetaTestForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnCreate = FormCreate 11 | DesignerMasterStyle = 3 12 | object Memo1: TMemo 13 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 14 | DataDetectorTypes = [] 15 | Align = Client 16 | Size.Width = 384.000000000000000000 17 | Size.Height = 479.000000000000000000 18 | Size.PlatformDefault = False 19 | TabOrder = 0 20 | Viewport.Width = 376.000000000000000000 21 | Viewport.Height = 471.000000000000000000 22 | end 23 | object Button1: TButton 24 | Align = Top 25 | Size.Width = 384.000000000000000000 26 | Size.Height = 44.000000000000000000 27 | Size.PlatformDefault = False 28 | TabOrder = 1 29 | Text = 'Get String Metadata' 30 | OnClick = Button1Click 31 | end 32 | object Button2: TButton 33 | Align = Top 34 | Position.Y = 44.000000000000000000 35 | Size.Width = 384.000000000000000000 36 | Size.Height = 44.000000000000000000 37 | Size.PlatformDefault = False 38 | TabOrder = 2 39 | Text = 'String References' 40 | OnClick = Button2Click 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /06/Strings101/Strings101.dpr: -------------------------------------------------------------------------------- 1 | program Strings101; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | Strings101Form in 'Strings101Form.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /06/Strings101/Strings101.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/06/Strings101/Strings101.res -------------------------------------------------------------------------------- /06/Strings101/Strings101Form.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Concatenate' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'SetLength Concatenate' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /07/ClicksCount/ClicksCount.dpr: -------------------------------------------------------------------------------- 1 | program ClicksCount; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ClicksCountForm in 'ClicksCountForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/ClicksCount/ClicksCount.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/ClicksCount/ClicksCount.res -------------------------------------------------------------------------------- /07/ClicksCount/ClicksCountForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnMouseDown = FormMouseDown 11 | DesignerMasterStyle = 3 12 | object Label1: TLabel 13 | Align = Top 14 | Position.Y = 44.000000000000000000 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 41.000000000000000000 17 | Size.PlatformDefault = False 18 | TextSettings.HorzAlign = Center 19 | Text = '0' 20 | end 21 | object Button1: TButton 22 | Align = Top 23 | Size.Width = 384.000000000000000000 24 | Size.Height = 44.000000000000000000 25 | Size.PlatformDefault = False 26 | TabOrder = 1 27 | Text = 'New Form' 28 | OnClick = Button1Click 29 | end 30 | object Button2: TButton 31 | Align = Bottom 32 | Position.Y = 523.000000000000000000 33 | Size.Width = 384.000000000000000000 34 | Size.Height = 44.000000000000000000 35 | Size.PlatformDefault = False 36 | TabOrder = 2 37 | Text = 'Close' 38 | OnClick = Button2Click 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /07/ClicksCount/ClicksCountForm.pas: -------------------------------------------------------------------------------- 1 | unit ClicksCountForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Controls.Presentation; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Label1: TLabel; 13 | Button1: TButton; 14 | Button2: TButton; 15 | procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 16 | Shift: TShiftState; X, Y: Single); 17 | procedure Button1Click(Sender: TObject); 18 | procedure Button2Click(Sender: TObject); 19 | public 20 | function GetClicks: Integer; 21 | private 22 | nClicks: Integer; 23 | end; 24 | 25 | var 26 | Form1: TForm1; 27 | 28 | implementation 29 | 30 | {$R *.fmx} 31 | 32 | procedure TForm1.Button1Click(Sender: TObject); 33 | var 34 | NewForm: TForm1; 35 | begin 36 | NewForm := TForm1.Create(Application); 37 | NewForm.Show; 38 | end; 39 | 40 | procedure TForm1.Button2Click(Sender: TObject); 41 | begin 42 | Close; 43 | end; 44 | 45 | procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; 46 | Shift: TShiftState; X, Y: Single); 47 | begin 48 | Inc (nClicks); 49 | Label1.Text := nClicks.ToString; 50 | end; 51 | 52 | function TForm1.GetClicks: Integer; 53 | begin 54 | Result := nClicks; 55 | end; 56 | 57 | end. 58 | -------------------------------------------------------------------------------- /07/CreateComps/CreateComps.dpr: -------------------------------------------------------------------------------- 1 | program CreateComps; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | CreateCompsForm in 'CreateCompsForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/CreateComps/CreateComps.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/CreateComps/CreateComps.res -------------------------------------------------------------------------------- /07/CreateComps/CreateCompsForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnMouseDown = FormMouseDown 11 | DesignerMasterStyle = 3 12 | end 13 | -------------------------------------------------------------------------------- /07/CreateComps/CreateCompsForm.pas: -------------------------------------------------------------------------------- 1 | unit CreateCompsForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls; 8 | 9 | type 10 | TForm1 = class(TForm) 11 | procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 12 | Shift: TShiftState; X, Y: Single); 13 | private 14 | { Private declarations } 15 | public 16 | { Public declarations } 17 | end; 18 | 19 | var 20 | Form1: TForm1; 21 | 22 | implementation 23 | 24 | {$R *.fmx} 25 | 26 | procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; 27 | Shift: TShiftState; X, Y: Single); 28 | var 29 | Btn: TButton; 30 | begin 31 | Btn := TButton.Create (Self); 32 | Btn.Parent := Self; 33 | Btn.Position.X := X; 34 | Btn.Position.Y := Y; 35 | Btn.Height := 35; 36 | Btn.Width := 135; 37 | Btn.Text := Format ('At %d, %d', [Round(X), Round(Y)]); 38 | end; 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /07/Dates1/Dates1.dpr: -------------------------------------------------------------------------------- 1 | program Dates1; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DatesForm in 'DatesForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/Dates1/Dates1.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/Dates1/Dates1.res -------------------------------------------------------------------------------- /07/Dates1/DatesForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Leap Year' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /07/Dates2/Dates2.dpr: -------------------------------------------------------------------------------- 1 | program Dates2; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DatesForm in 'DatesForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/Dates2/Dates2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/Dates2/Dates2.res -------------------------------------------------------------------------------- /07/Dates2/DatesForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Leap Year' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /07/Dates3/Dates3.dpr: -------------------------------------------------------------------------------- 1 | program Dates3; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DatesForm in 'DatesForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/Dates3/Dates3.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/Dates3/Dates3.res -------------------------------------------------------------------------------- /07/Dates4/Dates4.dpr: -------------------------------------------------------------------------------- 1 | program Dates4; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DatesForm in 'DatesForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /07/Dates4/Dates4.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/Dates4/Dates4.res -------------------------------------------------------------------------------- /07/NestedTypes/NestedClass.pas: -------------------------------------------------------------------------------- 1 | unit NestedClass; 2 | 3 | interface 4 | 5 | type 6 | TOne = class 7 | private 8 | someData: Integer; 9 | public 10 | // nested constant 11 | const foo = 12; 12 | // nested type 13 | type TInside = class 14 | type TInsideInside = class 15 | procedure Two; 16 | end; 17 | public 18 | procedure InsideHello; 19 | private 20 | Msg: string; 21 | InsIns: TInsideInside; 22 | end; 23 | public 24 | procedure Hello; 25 | constructor Create; 26 | end; 27 | 28 | implementation 29 | 30 | uses 31 | SysUtils, NestedTypesForm; 32 | 33 | { TOne } 34 | 35 | constructor TOne.Create; 36 | begin 37 | inherited Create; 38 | end; 39 | 40 | procedure TOne.Hello; 41 | var 42 | ins: TInside; 43 | begin 44 | ins := TInside.Create; 45 | try 46 | ins.Msg := 'hi'; 47 | ins.InsideHello; 48 | Show ('constant is ' + IntToStr (foo)); 49 | finally 50 | ins.Free; 51 | end; 52 | end; 53 | 54 | { TOne.TInside } 55 | 56 | procedure TOne.TInside.InsideHello; 57 | begin 58 | msg := 'new msg'; 59 | Show ('internal call'); 60 | if not Assigned (InsIns) then 61 | InsIns := TInsideInside.Create; 62 | InsIns.Two; 63 | end; 64 | 65 | { TOne.TInside.TInsideInside } 66 | 67 | procedure TOne.TInside.TInsideInside.Two; 68 | begin 69 | Show ('this is a method of a nested/nested class'); 70 | end; 71 | 72 | end. 73 | -------------------------------------------------------------------------------- /07/NestedTypes/NestedTypes.dpr: -------------------------------------------------------------------------------- 1 | program NestedTypes; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | NestedTypesForm in 'NestedTypesForm.pas' {Form1}, 8 | NestedClass in 'NestedClass.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /07/NestedTypes/NestedTypes.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/NestedTypes/NestedTypes.res -------------------------------------------------------------------------------- /07/NestedTypes/NestedTypesForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Use Nested Class' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /07/NestedTypes/NestedTypesForm.pas: -------------------------------------------------------------------------------- 1 | unit NestedTypesForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo, FMX.Controls.Presentation, FMX.ScrollBox; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Memo1: TMemo; 13 | Button1: TButton; 14 | procedure Button1Click(Sender: TObject); 15 | private 16 | { Private declarations } 17 | public 18 | procedure Show (const msg: string); 19 | end; 20 | 21 | var 22 | Form1: TForm1; 23 | 24 | // display function for secondary unit 25 | procedure Show (const msg: string); 26 | 27 | implementation 28 | 29 | {$R *.fmx} 30 | 31 | uses 32 | NestedClass; 33 | 34 | procedure Show (const msg: string); 35 | begin 36 | if Assigned (Form1) then 37 | Form1.Show(msg); 38 | end; 39 | 40 | procedure TForm1.Button1Click(Sender: TObject); 41 | var 42 | One: TOne; 43 | begin 44 | One := TOne.Create; 45 | One.Hello; 46 | One.Free; 47 | end; 48 | 49 | procedure TForm1.Show(const Msg: string); 50 | begin 51 | Memo1.Lines.Add(Msg); 52 | end; 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /07/ViewDates/ViewDates.dpr: -------------------------------------------------------------------------------- 1 | program ViewDates; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ViewDatesForm in 'ViewDatesForm.pas' {DateForm}, 8 | Dates in 'Dates.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TDateForm, DateForm); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /07/ViewDates/ViewDates.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/07/ViewDates/ViewDates.res -------------------------------------------------------------------------------- /08/Animals1/Animals1.dpr: -------------------------------------------------------------------------------- 1 | program Animals1; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AnimalsForm in 'AnimalsForm.pas' {Form1}, 8 | AnimalsClasses in 'AnimalsClasses.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /08/Animals1/Animals1.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals1/Animals1.res -------------------------------------------------------------------------------- /08/Animals1/AnimalsClasses.pas: -------------------------------------------------------------------------------- 1 | unit AnimalsClasses; 2 | 3 | interface 4 | 5 | type 6 | TAnimal = class 7 | public 8 | constructor Create; 9 | function GetKind: string; 10 | private 11 | FKind: string; 12 | end; 13 | 14 | TDog = class (TAnimal) 15 | public 16 | constructor Create; 17 | end; 18 | 19 | implementation 20 | 21 | { TAnimal } 22 | 23 | constructor TAnimal.Create; 24 | begin 25 | FKind := 'Animal'; 26 | end; 27 | 28 | function TAnimal.GetKind: string; 29 | begin 30 | Result := FKind; 31 | end; 32 | 33 | { TDog } 34 | 35 | constructor TDog.Create; 36 | begin 37 | inherited; 38 | FKind := 'Dog'; 39 | end; 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /08/Animals2/Animals2.dpr: -------------------------------------------------------------------------------- 1 | program Animals2; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AnimalsForm in 'AnimalsForm.pas' {Form1}, 8 | AnimalsClasses in 'AnimalsClasses.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /08/Animals2/Animals2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals2/Animals2.res -------------------------------------------------------------------------------- /08/Animals2/AnimalsClasses.pas: -------------------------------------------------------------------------------- 1 | unit AnimalsClasses; 2 | 3 | interface 4 | 5 | type 6 | TAnimal = class 7 | public 8 | constructor Create; 9 | function GetKind: string; 10 | function Voice: string; virtual; 11 | private 12 | FKind: string; 13 | end; 14 | 15 | TDog = class (TAnimal) 16 | public 17 | constructor Create; 18 | function Voice: string; override; 19 | end; 20 | 21 | implementation 22 | 23 | { TAnimal } 24 | 25 | constructor TAnimal.Create; 26 | begin 27 | FKind := 'Animal'; 28 | end; 29 | 30 | function TAnimal.GetKind: string; 31 | begin 32 | Result := FKind; 33 | end; 34 | 35 | function TAnimal.Voice: string; 36 | begin 37 | Result := 'AnimalVoice'; 38 | end; 39 | 40 | { TDog } 41 | 42 | constructor TDog.Create; 43 | begin 44 | inherited; 45 | FKind := 'Dog'; 46 | end; 47 | 48 | function TDog.Voice: string; 49 | begin 50 | Result := 'ArfArf'; 51 | end; 52 | 53 | end. 54 | -------------------------------------------------------------------------------- /08/Animals2/animalvoice.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals2/animalvoice.wav -------------------------------------------------------------------------------- /08/Animals2/arfarf.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals2/arfarf.wav -------------------------------------------------------------------------------- /08/Animals3/Animals3.dpr: -------------------------------------------------------------------------------- 1 | program Animals3; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AnimalsForm in 'AnimalsForm.pas' {Form1}, 8 | AnimalsClasses in 'AnimalsClasses.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /08/Animals3/Animals3.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals3/Animals3.res -------------------------------------------------------------------------------- /08/Animals3/AnimalsClasses.pas: -------------------------------------------------------------------------------- 1 | unit AnimalsClasses; 2 | 3 | interface 4 | 5 | type 6 | TAnimal = class 7 | public 8 | constructor Create; 9 | function GetKind: string; 10 | function Voice: string; virtual; abstract; 11 | private 12 | FKind: string; 13 | end; 14 | 15 | TDog = class (TAnimal) 16 | public 17 | constructor Create; 18 | function Voice: string; override; 19 | function Eat: string; virtual; 20 | end; 21 | 22 | TCat = class (TAnimal) 23 | public 24 | constructor Create; 25 | function Voice: string; override; 26 | function Eat: string; virtual; 27 | end; 28 | 29 | implementation 30 | 31 | { TAnimal } 32 | 33 | constructor TAnimal.Create; 34 | begin 35 | FKind := 'Animal'; 36 | end; 37 | 38 | function TAnimal.GetKind: string; 39 | begin 40 | Result := FKind; 41 | end; 42 | 43 | { TDog } 44 | 45 | constructor TDog.Create; 46 | begin 47 | inherited; 48 | FKind := 'Dog'; 49 | end; 50 | 51 | function TDog.Eat: string; 52 | begin 53 | Result := 'Bone'; 54 | end; 55 | 56 | function TDog.Voice: string; 57 | begin 58 | Result := 'ArfArf'; 59 | end; 60 | 61 | { TCat } 62 | 63 | constructor TCat.Create; 64 | begin 65 | inherited; 66 | FKind := 'Cat'; 67 | end; 68 | 69 | function TCat.Eat: string; 70 | begin 71 | Result := 'Mouse'; 72 | end; 73 | 74 | function TCat.Voice: string; 75 | begin 76 | Result := 'Mieow'; 77 | end; 78 | 79 | end. 80 | -------------------------------------------------------------------------------- /08/Animals3/animalvoice.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals3/animalvoice.wav -------------------------------------------------------------------------------- /08/Animals3/arfarf.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals3/arfarf.wav -------------------------------------------------------------------------------- /08/Animals3/mieow.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Animals3/mieow.wav -------------------------------------------------------------------------------- /08/DerivedDates/DerivedDates.dpr: -------------------------------------------------------------------------------- 1 | program DerivedDates; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ViewDatesForm in 'ViewDatesForm.pas' {DateForm}, 8 | Dates in 'Dates.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TDateForm, DateForm); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /08/DerivedDates/DerivedDates.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/DerivedDates/DerivedDates.res -------------------------------------------------------------------------------- /08/Protection/Protection.dpr: -------------------------------------------------------------------------------- 1 | program Protection; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ProtectionForm in 'ProtectionForm.pas' {Form1}, 8 | TestClass in 'TestClass.pas'; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /08/Protection/Protection.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/Protection/Protection.res -------------------------------------------------------------------------------- /08/Protection/ProtectionForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object Button1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Wrong' 26 | OnClick = Button1Click 27 | end 28 | object Button2: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Hack' 36 | OnClick = Button2Click 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /08/Protection/ProtectionForm.pas: -------------------------------------------------------------------------------- 1 | unit ProtectionForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Memo1: TMemo; 13 | Button1: TButton; 14 | Button2: TButton; 15 | procedure Button1Click(Sender: TObject); 16 | procedure Button2Click(Sender: TObject); 17 | private 18 | { Private declarations } 19 | public 20 | procedure Show (const msg: string); 21 | end; 22 | 23 | var 24 | Form1: TForm1; 25 | 26 | implementation 27 | 28 | {$R *.fmx} 29 | 30 | uses 31 | TestClass; 32 | 33 | procedure TForm1.Button1Click(Sender: TObject); 34 | var 35 | Obj: TTest; 36 | begin 37 | Obj := TTest.Create; 38 | Obj.PublicData := 10; 39 | // Obj.ProtectedData := 20; //won't compile 40 | Show (Obj.GetValue); 41 | Obj.Free; 42 | end; 43 | 44 | type 45 | TFake = class (TTest); 46 | 47 | procedure TForm1.Button2Click(Sender: TObject); 48 | var 49 | Obj: TTest; 50 | begin 51 | Obj := TTest.Create; 52 | Obj.PublicData := 10; 53 | TFake (Obj).ProtectedData := 20; // compiles! 54 | Show (Obj.GetValue); 55 | Obj.Free; 56 | end; 57 | 58 | procedure TForm1.Show(const Msg: string); 59 | begin 60 | Memo1.Lines.Add(Msg); 61 | end; 62 | 63 | end. 64 | -------------------------------------------------------------------------------- /08/Protection/TestClass.pas: -------------------------------------------------------------------------------- 1 | unit TestClass; 2 | 3 | interface 4 | 5 | type 6 | TTest = class 7 | protected 8 | ProtectedData: Integer; 9 | public 10 | PublicData: Integer; 11 | function GetValue: string; 12 | end; 13 | 14 | implementation 15 | 16 | uses 17 | SysUtils; 18 | 19 | function TTest.GetValue: string; 20 | begin 21 | Result := Format ('Public: %d, Protected: %d', 22 | [PublicData, ProtectedData]); 23 | end; 24 | 25 | end. 26 | -------------------------------------------------------------------------------- /08/ReintroduceTest/ReintroduceForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 523.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 515.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Test' 29 | OnClick = Button1Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /08/ReintroduceTest/ReintroduceTest.dpr: -------------------------------------------------------------------------------- 1 | program ReintroduceTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ReintroduceForm in 'ReintroduceForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /08/ReintroduceTest/ReintroduceTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/ReintroduceTest/ReintroduceTest.res -------------------------------------------------------------------------------- /08/VirtualInheritTest/Unit1.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Position.X = 48.000000000000000000 13 | Position.Y = 48.000000000000000000 14 | Size.Width = 265.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Show Form' 19 | OnClick = Button1Click 20 | end 21 | object Button2: TButton 22 | Position.X = 48.000000000000000000 23 | Position.Y = 120.000000000000000000 24 | Size.Width = 265.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Hello' 29 | OnClick = Button2Click 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /08/VirtualInheritTest/Unit1.pas: -------------------------------------------------------------------------------- 1 | unit Unit1; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Controls.Presentation; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Button1: TButton; 13 | Button2: TButton; 14 | procedure Button1Click(Sender: TObject); 15 | procedure Button2Click(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | Form1: TForm1; 24 | 25 | implementation 26 | 27 | {$R *.fmx} 28 | 29 | uses 30 | unit2; 31 | 32 | procedure TForm1.Button1Click(Sender: TObject); 33 | begin 34 | Form2.Show; 35 | end; 36 | 37 | procedure TForm1.Button2Click(Sender: TObject); 38 | begin 39 | ShowMessage ('Hello from Form1'); 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /08/VirtualInheritTest/Unit2.fmx: -------------------------------------------------------------------------------- 1 | inherited Form2: TForm2 2 | Caption = 'Form2' 3 | DesignerMobile = True 4 | DesignerWidth = 384 5 | DesignerHeight = 592 6 | DesignerDeviceName = 'Google Nexus 4' 7 | DesignerOrientation = 0 8 | DesignerOSVersion = '' 9 | inherited Button1: TButton 10 | Text = 'Hide Form' 11 | end 12 | object Button3: TButton 13 | Height = 44.000000000000000000 14 | Position.X = 48.000000000000000000 15 | Position.Y = 192.000000000000000000 16 | TabOrder = 2 17 | Text = 'New Button' 18 | Trimming = ttCharacter 19 | Width = 257.000000000000000000 20 | OnClick = Button3Click 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /08/VirtualInheritTest/Unit2.pas: -------------------------------------------------------------------------------- 1 | unit Unit2; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, 8 | Unit1; 9 | 10 | type 11 | TForm2 = class(TForm1) 12 | Button3: TButton; 13 | procedure Button1Click(Sender: TObject); 14 | procedure Button2Click(Sender: TObject); 15 | procedure Button3Click(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | Form2: TForm2; 24 | 25 | implementation 26 | 27 | {$R *.fmx} 28 | 29 | procedure TForm2.Button1Click(Sender: TObject); 30 | begin 31 | // inherited; 32 | Hide; 33 | end; 34 | 35 | procedure TForm2.Button2Click(Sender: TObject); 36 | begin 37 | inherited; 38 | ShowMessage ('Hello from Form2'); 39 | end; 40 | 41 | procedure TForm2.Button3Click(Sender: TObject); 42 | begin 43 | inherited; 44 | Button3.Text := Button3.Text + '*'; 45 | end; 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /08/VirtualInheritTest/VirtualInheritTest.dpr: -------------------------------------------------------------------------------- 1 | program VirtualInheritTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | Unit1 in 'Unit1.pas' {Form1}, 8 | Unit2 in 'Unit2.pas' {Form2}; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.CreateForm(TForm2, Form2); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /08/VirtualInheritTest/VirtualInheritTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/08/VirtualInheritTest/VirtualInheritTest.res -------------------------------------------------------------------------------- /09/AdvancedExcept/AdvancedExcept.dpr: -------------------------------------------------------------------------------- 1 | program AdvancedExcept; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {FormExceptions}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TFormExceptions, FormExceptions); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/AdvancedExcept/AdvancedExcept.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/AdvancedExcept/AdvancedExcept.res -------------------------------------------------------------------------------- /09/ConstructorExcept/ConstructorExcept.dpr: -------------------------------------------------------------------------------- 1 | program ConstructorExcept; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/ConstructorExcept/ConstructorExcept.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/ConstructorExcept/ConstructorExcept.res -------------------------------------------------------------------------------- /09/ConstructorExcept/ExceptionForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnNoException: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'No Exception' 26 | OnClick = btnNoExceptionClick 27 | end 28 | object btnRaiseException: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Raise Exception' 36 | OnClick = btnRaiseExceptionClick 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /09/ErrorLog/ErrorLog.dpr: -------------------------------------------------------------------------------- 1 | program ErrorLog; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/ErrorLog/ErrorLog.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/ErrorLog/ErrorLog.res -------------------------------------------------------------------------------- /09/ExceptionFinally/ExceptFinally.dpr: -------------------------------------------------------------------------------- 1 | program ExceptFinally; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/ExceptionFinally/ExceptFinally.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/ExceptionFinally/ExceptFinally.res -------------------------------------------------------------------------------- /09/ExceptionFinally/ExceptionForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 435.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnWrong: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Wrong' 26 | OnClick = btnWrongClick 27 | end 28 | object btnFinally: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 3 35 | Text = 'Finally' 36 | OnClick = btnFinallyClick 37 | end 38 | object Button1: TButton 39 | Align = Top 40 | Position.Y = 88.000000000000000000 41 | Size.Width = 384.000000000000000000 42 | Size.Height = 44.000000000000000000 43 | Size.PlatformDefault = False 44 | TabOrder = 2 45 | Text = 'Try Try' 46 | OnClick = Button1Click 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /09/ExceptionFlow/ExceptionFlow.dpr: -------------------------------------------------------------------------------- 1 | program ExceptionFlow; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/ExceptionFlow/ExceptionFlow.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/ExceptionFlow/ExceptionFlow.res -------------------------------------------------------------------------------- /09/ExceptionFlow/ExceptionForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object ButtonRaise1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Raise 1' 26 | end 27 | object ButtonRaise2: TButton 28 | Align = Top 29 | Position.Y = 44.000000000000000000 30 | Size.Width = 384.000000000000000000 31 | Size.Height = 44.000000000000000000 32 | Size.PlatformDefault = False 33 | TabOrder = 2 34 | Text = 'Raise 2' 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /09/ExceptionTest/ExceptionForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object Button1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Suppress Exception' 26 | OnClick = Button1Click 27 | end 28 | object Button2: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Show Error And Continue' 36 | OnClick = Button2Click 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /09/ExceptionTest/ExceptionTest.dpr: -------------------------------------------------------------------------------- 1 | program ExceptionTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ExceptionForm in 'ExceptionForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /09/ExceptionTest/ExceptionTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/09/ExceptionTest/ExceptionTest.res -------------------------------------------------------------------------------- /10/AutoRTTI/AutoRTTI.dpr: -------------------------------------------------------------------------------- 1 | program AutoRTTI; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AutoRTTIForm in 'AutoRTTIForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /10/AutoRTTI/AutoRTTI.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/AutoRTTI/AutoRTTI.res -------------------------------------------------------------------------------- /10/AutoRTTI/AutoRTTIForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 523.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnTest: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Test' 26 | OnClick = btnTestClick 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /10/AutoRTTI/AutoRTTIForm.pas: -------------------------------------------------------------------------------- 1 | unit AutoRTTIForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Memo1: TMemo; 13 | btnTest: TButton; 14 | procedure btnTestClick(Sender: TObject); 15 | private 16 | public 17 | procedure Show (const msg: string); 18 | end; 19 | 20 | var 21 | Form1: TForm1; 22 | 23 | type 24 | TMyTestClass = class 25 | private 26 | FValue: Integer; 27 | procedure SetValue(const Value: Integer); 28 | published 29 | property Value: Integer read FValue write SetValue; 30 | end; 31 | 32 | implementation 33 | 34 | {$R *.fmx} 35 | 36 | uses 37 | TypInfo; 38 | 39 | procedure TForm1.btnTestClick(Sender: TObject); 40 | var 41 | test1: TMyTestClass; 42 | begin 43 | test1 := TMyTestClass.Create; 44 | try 45 | test1.Value := 22; 46 | Memo1.Lines.Add (GetPropValue (test1, 'Value')); 47 | finally 48 | test1.Free; 49 | end; 50 | end; 51 | 52 | procedure TForm1.Show(const Msg: string); 53 | begin 54 | Memo1.Lines.Add(Msg); 55 | end; 56 | 57 | { TMyTestClass } 58 | 59 | procedure TMyTestClass.SetValue(const Value: Integer); 60 | begin 61 | FValue := Value; 62 | end; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /10/DateComponent/DateCompTest.dpr: -------------------------------------------------------------------------------- 1 | program DateCompTest; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DateCompTestForm in 'DateCompTestForm.pas' {FormDate}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TFormDate, FormDate); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /10/DateComponent/DateCompTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/DateComponent/DateCompTest.res -------------------------------------------------------------------------------- /10/DateComponent/DateCompTestForm.fmx: -------------------------------------------------------------------------------- 1 | object FormDate: TFormDate 2 | Left = 0 3 | Top = 0 4 | Caption = 'DateComponent' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnCreate = FormCreate 11 | DesignerMasterStyle = 3 12 | object btnInc: TButton 13 | Align = Top 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Increase' 19 | OnClick = btnIncClick 20 | end 21 | object Label1: TLabel 22 | Align = Top 23 | StyledSettings = [Family, Style, FontColor] 24 | Position.Y = 44.000000000000000000 25 | Size.Width = 384.000000000000000000 26 | Size.Height = 23.000000000000000000 27 | Size.PlatformDefault = False 28 | TextSettings.Font.Size = 16.000000000000000000 29 | TextSettings.HorzAlign = Center 30 | Text = 'Label1' 31 | end 32 | object Date1: TDate 33 | Day = 14 34 | Month = 11 35 | Year = 2014 36 | OnChange = Date1Change 37 | Left = 80 38 | Top = 112 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /10/DateComponent/DateCompTestForm.pas: -------------------------------------------------------------------------------- 1 | unit DateCompTestForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo, DateComponent; 9 | 10 | type 11 | TFormDate = class(TForm) 12 | btnInc: TButton; 13 | Date1: TDate; 14 | Label1: TLabel; 15 | procedure Date1Change(Sender: TObject); 16 | procedure btnIncClick(Sender: TObject); 17 | procedure FormCreate(Sender: TObject); 18 | private 19 | public 20 | end; 21 | 22 | var 23 | FormDate: TFormDate; 24 | 25 | implementation 26 | 27 | {$R *.fmx} 28 | 29 | 30 | procedure TFormDate.btnIncClick(Sender: TObject); 31 | begin 32 | Date1.Increase; 33 | end; 34 | 35 | procedure TFormDate.Date1Change(Sender: TObject); 36 | begin 37 | Label1.Text := Date1.GetText; 38 | end; 39 | 40 | procedure TFormDate.FormCreate(Sender: TObject); 41 | begin 42 | Label1.Text := Date1.GetText; 43 | end; 44 | 45 | end. 46 | -------------------------------------------------------------------------------- /10/DateComponent/DatePackage.dpk: -------------------------------------------------------------------------------- 1 | package DatePackage; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$IMPLICITBUILD ON} 29 | 30 | requires 31 | rtl; 32 | 33 | contains 34 | DateComponent in 'DateComponent.pas'; 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /10/DateComponent/DatePackage.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/DateComponent/DatePackage.res -------------------------------------------------------------------------------- /10/DynamicEvents/DynamicEvents.dpr: -------------------------------------------------------------------------------- 1 | program DynamicEvents; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | DynamicEventsForm in 'DynamicEventsForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TFormDynamic, FormDynamic); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /10/DynamicEvents/DynamicEvents.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/DynamicEvents/DynamicEvents.res -------------------------------------------------------------------------------- /10/DynamicEvents/DynamicEventsForm.fmx: -------------------------------------------------------------------------------- 1 | object FormDynamic: TFormDynamic 2 | Left = 0 3 | Top = 0 4 | Caption = 'DynamicEvents' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | OnMouseDown = FormMouseDown 11 | DesignerMasterStyle = 3 12 | object btnTest: TButton 13 | Align = Top 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 44.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'Test' 19 | OnClick = btnTestClick 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /10/FormProperties/FormProperties.dpr: -------------------------------------------------------------------------------- 1 | program FormProperties; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | FormPropertiesForm in 'FormPropertiesForm.pas' {FormProp}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.CreateForm(TFormProp, FormProp); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /10/FormProperties/FormProperties.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/FormProperties/FormProperties.res -------------------------------------------------------------------------------- /10/FormProperties/FormPropertiesForm.fmx: -------------------------------------------------------------------------------- 1 | object FormProp: TFormProp 2 | Left = 0 3 | Top = 0 4 | Caption = 'FormProp' 5 | ClientHeight = 480 6 | ClientWidth = 312 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop, iPhone] 10 | OnMouseDown = FormMouseDown 11 | DesignerMasterStyle = 3 12 | object ToolBarStatus: TToolBar 13 | Align = Bottom 14 | Position.Y = 432.000000000000000000 15 | Size.Width = 312.000000000000000000 16 | Size.Height = 48.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | object LabelStatus: TLabel 20 | Align = Client 21 | Margins.Left = 20.000000000000000000 22 | Margins.Right = 20.000000000000000000 23 | Size.Width = 272.000000000000000000 24 | Size.Height = 48.000000000000000000 25 | Size.PlatformDefault = False 26 | Text = 'Status' 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /10/NumbersEnumerator/NumbersEnumerator.dpr: -------------------------------------------------------------------------------- 1 | program NumbersEnumerator; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | NumbersEnumerator_MainForm in 'NumbersEnumerator_MainForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /10/NumbersEnumerator/NumbersEnumerator.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/NumbersEnumerator/NumbersEnumerator.res -------------------------------------------------------------------------------- /10/NumbersEnumerator/NumbersEnumerator_MainForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 523.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnTest: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'btnTest' 26 | OnClick = btnTestClick 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /10/VarProp/VarProp.dpr: -------------------------------------------------------------------------------- 1 | program VarProp; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | VarPropForm in 'VarPropForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /10/VarProp/VarProp.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/10/VarProp/VarProp.res -------------------------------------------------------------------------------- /10/VarProp/VarPropForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 523.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnTest: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'btnTest' 26 | OnClick = btnTestClick 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/Adapter_Demo.dpr: -------------------------------------------------------------------------------- 1 | program Adapter_Demo; 2 | 3 | uses 4 | Forms, 5 | mainform in 'mainform.pas' {FormAdapter}, 6 | adapter_intf in 'adapter_intf.pas'; 7 | 8 | {$R *.RES} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.CreateForm(TFormAdapter, FormAdapter); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/Adapter_Demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/11/AdapterIntf_VCL/Adapter_Demo.res -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/IEdit.pas: -------------------------------------------------------------------------------- 1 | unit IEdit; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 | StdCtrls, adapter_intf; 8 | 9 | type 10 | TEdit = class(StdCtrls.TEdit, ITextAndValue) 11 | private 12 | { Private declarations } 13 | protected 14 | procedure SetText(const Value: string); 15 | procedure SetValue(const Value: Integer); 16 | function GetText: string; 17 | function GetValue: Integer; 18 | public 19 | { Public declarations } 20 | published 21 | { Published declarations } 22 | end; 23 | 24 | implementation 25 | 26 | { TIEdit } 27 | 28 | function TEdit.GetText: string; 29 | begin 30 | Result := Text; 31 | end; 32 | 33 | function TEdit.GetValue: Integer; 34 | begin 35 | Result := StrToIntDef (Text, 0); 36 | end; 37 | 38 | procedure TEdit.SetText(const Value: string); 39 | begin 40 | Text := Value; 41 | end; 42 | 43 | procedure TEdit.SetValue(const Value: Integer); 44 | begin 45 | Text := IntToStr (Value); 46 | end; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/ILabel.pas: -------------------------------------------------------------------------------- 1 | unit ILabel; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 | StdCtrls, adapter_intf; 8 | 9 | type 10 | TLabel = class(StdCtrls.TLabel, ITextAndValue) 11 | private 12 | { Private declarations } 13 | protected 14 | procedure SetText(const Value: string); 15 | procedure SetValue(const Value: Integer); 16 | function GetText: string; 17 | function GetValue: Integer; 18 | public 19 | { Public declarations } 20 | published 21 | { Published declarations } 22 | end; 23 | 24 | implementation 25 | 26 | { TILabel } 27 | 28 | function TLabel.GetText: string; 29 | begin 30 | Result := Caption; 31 | end; 32 | 33 | function TLabel.GetValue: Integer; 34 | begin 35 | Result := StrToIntDef (Caption, 0); 36 | end; 37 | 38 | procedure TLabel.SetText(const Value: string); 39 | begin 40 | Caption := Value; 41 | end; 42 | 43 | procedure TLabel.SetValue(const Value: Integer); 44 | begin 45 | Caption := IntToStr (Value); 46 | end; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/IProgressBar.pas: -------------------------------------------------------------------------------- 1 | unit IProgressBar; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 | ComCtrls, adapter_intf; 8 | 9 | type 10 | TProgressBar = class(ComCtrls.TProgressBar, ITextAndValue) 11 | private 12 | { Private declarations } 13 | protected 14 | procedure SetText(const Value: string); 15 | procedure SetValue(const Value: Integer); 16 | function GetText: string; 17 | function GetValue: Integer; 18 | public 19 | { Public declarations } 20 | published 21 | { Published declarations } 22 | end; 23 | 24 | implementation 25 | 26 | { TIProgressBar } 27 | 28 | function TProgressBar.GetText: string; 29 | begin 30 | Result := IntToStr (Position); 31 | end; 32 | 33 | function TProgressBar.GetValue: Integer; 34 | begin 35 | Result := Position; 36 | end; 37 | 38 | procedure TProgressBar.SetText(const Value: string); 39 | begin 40 | Position := StrToIntDef (Value, 0); 41 | end; 42 | 43 | procedure TProgressBar.SetValue(const Value: Integer); 44 | begin 45 | Position := Value; 46 | end; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /11/AdapterIntf_VCL/adapter_intf.pas: -------------------------------------------------------------------------------- 1 | unit adapter_intf; 2 | 3 | interface 4 | 5 | type 6 | ITextAndValue = interface 7 | ['{51018CF1-0D3C-488E-81B0-0470B09013EB}'] 8 | procedure SetText(const Value: string); 9 | procedure SetValue(const Value: Integer); 10 | function GetText: string; 11 | function GetValue: Integer; 12 | property Text: string read GetText write SetText; 13 | property Value: Integer read GetValue write SetValue; 14 | end; 15 | 16 | implementation 17 | 18 | end. 19 | -------------------------------------------------------------------------------- /11/Intf101/InterfaceForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'InterfaceForm' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object Button1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Use with Object' 26 | end 27 | object Button2: TButton 28 | Align = Top 29 | Position.Y = 44.000000000000000000 30 | Size.Width = 384.000000000000000000 31 | Size.Height = 44.000000000000000000 32 | Size.PlatformDefault = False 33 | TabOrder = 2 34 | Text = 'Use with Interface' 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /11/Intf101/Intf101.dpr: -------------------------------------------------------------------------------- 1 | program Intf101; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | InterfaceForm in 'InterfaceForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /11/Intf101/Intf101.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/11/Intf101/Intf101.res -------------------------------------------------------------------------------- /11/IntfDemo/IntfDemo.dpr: -------------------------------------------------------------------------------- 1 | program IntfDemo; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | InterfaceForm in 'InterfaceForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /11/IntfDemo/IntfDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/11/IntfDemo/IntfDemo.res -------------------------------------------------------------------------------- /11/IntfError/InterfaceForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'InterfaceForm' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object btnMix: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Mix (Error)' 26 | OnClick = btnMixClick 27 | end 28 | object btnIntfOnly: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Interface only' 36 | OnClick = btnIntfOnlyClick 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /11/IntfError/IntfError.dpr: -------------------------------------------------------------------------------- 1 | program IntfError; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | InterfaceForm in 'InterfaceForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /11/IntfError/IntfError.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/11/IntfError/IntfError.res -------------------------------------------------------------------------------- /11/ObjFromIntf_VCL/ObjFromIntf.dpr: -------------------------------------------------------------------------------- 1 | program ObjFromIntf; 2 | 3 | uses 4 | Forms, 5 | ObjFromIntfMainForm in 'ObjFromIntfMainForm.pas' {Form39}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm39, Form39); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /11/ObjFromIntf_VCL/ObjFromIntf.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/11/ObjFromIntf_VCL/ObjFromIntf.res -------------------------------------------------------------------------------- /11/ObjFromIntf_VCL/ObjFromIntfMainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form39: TForm39 2 | Left = 0 3 | Top = 0 4 | Caption = 'ObjFromIntf' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnSimpleTest: TButton 17 | Left = 56 18 | Top = 48 19 | Width = 185 20 | Height = 25 21 | Caption = 'btnSimpleTest' 22 | TabOrder = 0 23 | OnClick = btnSimpleTestClick 24 | end 25 | object btnRefCountIssue: TButton 26 | Left = 56 27 | Top = 88 28 | Width = 185 29 | Height = 25 30 | Caption = 'btnRefCountIssue' 31 | TabOrder = 1 32 | OnClick = btnRefCountIssueClick 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /12/ClassCtor_VCL/ClassCtor.dpr: -------------------------------------------------------------------------------- 1 | program ClassCtor; 2 | 3 | uses 4 | Forms, 5 | ClassCtorMainForm in 'ClassCtorMainForm.pas' {Form39}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm39, Form39); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /12/ClassCtor_VCL/ClassCtor.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/ClassCtor_VCL/ClassCtor.res -------------------------------------------------------------------------------- /12/ClassCtor_VCL/ClassCtorMainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form39: TForm39 2 | Left = 0 3 | Top = 0 4 | Caption = 'ClassCtor' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object Button1: TButton 17 | Left = 24 18 | Top = 32 19 | Width = 75 20 | Height = 25 21 | Caption = 'Button1' 22 | TabOrder = 0 23 | OnClick = Button1Click 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /12/ClassCtor_VCL/ClassCtorMainForm.pas: -------------------------------------------------------------------------------- 1 | unit ClassCtorMainForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TForm39 = class(TForm) 11 | Button1: TButton; 12 | procedure Button1Click(Sender: TObject); 13 | private 14 | { Private declarations } 15 | public 16 | { Public declarations } 17 | end; 18 | 19 | var 20 | Form39: TForm39; 21 | 22 | implementation 23 | 24 | {$R *.dfm} 25 | 26 | type 27 | TTestClass = class 28 | public 29 | class var 30 | StartTime: TDateTime; 31 | EndTime: TDateTime; 32 | public 33 | class constructor Create; 34 | // class constructor Foo; 35 | class destructor Destroyer; 36 | end; 37 | 38 | 39 | 40 | procedure TForm39.Button1Click(Sender: TObject); 41 | begin 42 | ShowMessage (TimeToStr (TTestClass.StartTime)); 43 | end; 44 | 45 | { TTestClass } 46 | 47 | class constructor TTestClass.Create; 48 | begin 49 | StartTime := Now; 50 | end; 51 | 52 | class destructor TTestClass.Destroyer; 53 | begin 54 | EndTime := Now; 55 | end; 56 | 57 | //class constructor TTestClass.Foo; 58 | //begin 59 | // ShowMessage ('Foo'); 60 | //end; 61 | 62 | initialization 63 | ShowMessage (TimeToStr (TTestClass.StartTime)); 64 | 65 | finalization 66 | ShowMessage (TimeToStr (TTestClass.EndTime)); 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /12/ClassHelpers_VCL/Classhelpers.dpr: -------------------------------------------------------------------------------- 1 | program Classhelpers; 2 | 3 | uses 4 | Vcl.Forms, 5 | ClasshelpersForm in 'ClasshelpersForm.pas' {Form4}, 6 | Vcl.Themes, 7 | Vcl.Styles; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.MainFormOnTaskbar := True; 14 | Application.CreateForm(TForm4, Form4); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /12/ClassHelpers_VCL/Classhelpers.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/ClassHelpers_VCL/Classhelpers.res -------------------------------------------------------------------------------- /12/ClassHelpers_VCL/ClasshelpersForm.dfm: -------------------------------------------------------------------------------- 1 | object Form4: TForm4 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form4' 5 | ClientHeight = 347 6 | ClientWidth = 528 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -18 11 | Font.Name = 'Segoe UI Light' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | PixelsPerInch = 96 16 | TextHeight = 25 17 | object Button1: TButton 18 | Left = 32 19 | Top = 32 20 | Width = 85 21 | Height = 46 22 | Margins.Left = 2 23 | Margins.Top = 2 24 | Margins.Right = 2 25 | Margins.Bottom = 2 26 | Caption = 'Button1' 27 | TabOrder = 0 28 | OnClick = Button1Click 29 | end 30 | object ListBox1: TListBox 31 | Left = 129 32 | Top = 32 33 | Width = 156 34 | Height = 156 35 | Margins.Left = 2 36 | Margins.Top = 2 37 | Margins.Right = 2 38 | Margins.Bottom = 2 39 | ItemHeight = 25 40 | Items.Strings = ( 41 | 'we' 42 | 'r' 43 | 'ewr' 44 | 'ewtew' 45 | 'twr' 46 | 't') 47 | TabOrder = 1 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /12/ClassHelpers_VCL/ClasshelpersForm.pas: -------------------------------------------------------------------------------- 1 | unit ClasshelpersForm; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; 8 | 9 | type 10 | TForm4 = class(TForm) 11 | Button1: TButton; 12 | ListBox1: TListBox; 13 | procedure Button1Click(Sender: TObject); 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | end; 19 | 20 | var 21 | Form4: TForm4; 22 | 23 | implementation 24 | 25 | {$R *.dfm} 26 | 27 | type 28 | TMylistBox = class helper for TListBox 29 | function SelText: string; 30 | end; 31 | 32 | TMyInt = record helper for Integer 33 | function AsString: string; 34 | end; 35 | 36 | procedure TForm4.Button1Click(Sender: TObject); 37 | var 38 | n: Integer; 39 | begin 40 | ShowMessage (ListBox1.SelText); 41 | n := 3; 42 | Caption := n.AsString; 43 | 44 | Caption := Integer (12).AsString; 45 | end; 46 | 47 | { TMylistBox } 48 | 49 | function TMylistBox.SelText: string; 50 | begin 51 | Result := Items[ItemIndex]; 52 | end; 53 | 54 | { TMyInt } 55 | 56 | function TMyInt.AsString: string; 57 | begin 58 | Result := IntToStr (self); 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /12/ClassRef/ClassRef.dpr: -------------------------------------------------------------------------------- 1 | program ClassRef; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ClassRefForm in 'ClassRefForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /12/ClassRef/ClassRef.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/ClassRef/ClassRef.res -------------------------------------------------------------------------------- /12/ClassStatic_VCL/ClassStatic.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/ClassStatic_VCL/ClassStatic.res -------------------------------------------------------------------------------- /12/ControlHelper/ControlHelper.dpr: -------------------------------------------------------------------------------- 1 | program ControlHelper; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | HelperForm in 'HelperForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /12/ControlHelper/ControlHelper.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/ControlHelper/ControlHelper.res -------------------------------------------------------------------------------- /12/RecordHelpers_VCL/RecordHelpers.dpr: -------------------------------------------------------------------------------- 1 | program RecordHelpers; 2 | 3 | uses 4 | Vcl.Forms, 5 | RecordHelpers_MainForm in 'RecordHelpers_MainForm.pas' {Form4}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm4, Form4); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /12/RecordHelpers_VCL/RecordHelpers.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/RecordHelpers_VCL/RecordHelpers.res -------------------------------------------------------------------------------- /12/RecordHelpers_VCL/RecordHelpers_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form4: TForm4 2 | Left = 0 3 | Top = 0 4 | Caption = 'RecordHelpers' 5 | ClientHeight = 291 6 | ClientWidth = 633 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -13 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 120 15 | TextHeight = 16 16 | object Button1: TButton 17 | Left = 48 18 | Top = 40 19 | Width = 75 20 | Height = 25 21 | Caption = 'string' 22 | TabOrder = 0 23 | OnClick = Button1Click 24 | end 25 | object Button2: TButton 26 | Left = 48 27 | Top = 80 28 | Width = 75 29 | Height = 25 30 | Caption = 'integer' 31 | TabOrder = 1 32 | OnClick = Button2Click 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /12/StaticCallBack_VCL/CallBackForm.dfm: -------------------------------------------------------------------------------- 1 | object FormCallBack: TFormCallBack 2 | Left = 0 3 | Top = 0 4 | Caption = 'FormCallBack' 5 | ClientHeight = 292 6 | ClientWidth = 460 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object ListBox1: TListBox 18 | Left = 16 19 | Top = 16 20 | Width = 417 21 | Height = 265 22 | ItemHeight = 13 23 | TabOrder = 0 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /12/StaticCallBack_VCL/CallBackForm.pas: -------------------------------------------------------------------------------- 1 | unit CallBackForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TFormCallBack = class(TForm) 11 | ListBox1: TListBox; 12 | procedure FormCreate(Sender: TObject); 13 | private 14 | class var 15 | nTimerCount: Integer; 16 | public 17 | class procedure TimerCallBack (hwnd: THandle; uMsg, idEvent, dwTime: Cardinal); static; stdcall; 18 | end; 19 | 20 | var 21 | FormCallBack: TFormCallBack; 22 | 23 | implementation 24 | 25 | {$R *.dfm} 26 | 27 | const 28 | TIMERID = 100; 29 | 30 | procedure TFormCallBack.FormCreate(Sender: TObject); 31 | var 32 | callback: TFNTimerProc; 33 | begin 34 | nTimerCount := 0; 35 | callback := TFNTimerProc(@TFormCallBack.TimerCallBack); 36 | SetTimer(Handle, TIMERID, 1000, callback); 37 | end; 38 | 39 | class procedure TFormCallBack.TimerCallBack(hwnd: THandle; uMsg, idEvent, 40 | dwTime: Cardinal); 41 | begin 42 | try 43 | Inc (nTimerCount); 44 | FormCallBack.ListBox1.Items.Add (IntToStr (nTimerCount) + ' at ' + TimeToStr(Now)); 45 | except on E: Exception do 46 | Application.HandleException(nil); 47 | end; 48 | end; 49 | 50 | end. 51 | -------------------------------------------------------------------------------- /12/StaticCallBack_VCL/StaticCallBack.dpr: -------------------------------------------------------------------------------- 1 | program StaticCallBack; 2 | 3 | uses 4 | Forms, 5 | CallBackForm in 'CallBackForm.pas' {FormCallBack}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormCallBack, FormCallBack); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /12/StaticCallBack_VCL/StaticCallBack.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/StaticCallBack_VCL/StaticCallBack.res -------------------------------------------------------------------------------- /12/TypeAliasHelper/HelperForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'InterfaceForm' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Align = Top 13 | Size.Width = 384.000000000000000000 14 | Size.Height = 44.000000000000000000 15 | Size.PlatformDefault = False 16 | TabOrder = 0 17 | Text = 'Plain Code' 18 | OnClick = Button1Click 19 | end 20 | object Button2: TButton 21 | Align = Top 22 | Position.Y = 44.000000000000000000 23 | Size.Width = 384.000000000000000000 24 | Size.Height = 44.000000000000000000 25 | Size.PlatformDefault = False 26 | TabOrder = 1 27 | Text = 'ListBox Helper' 28 | end 29 | object Memo1: TMemo 30 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 31 | Align = Bottom 32 | Position.Y = 88.000000000000000000 33 | Size.Width = 384.000000000000000000 34 | Size.Height = 479.000000000000000000 35 | Size.PlatformDefault = False 36 | TabOrder = 2 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /12/TypeAliasHelper/HelperForm.pas: -------------------------------------------------------------------------------- 1 | unit HelperForm; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 | FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8 | FMX.Layouts, FMX.Memo, FMX.ListBox; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | Button1: TButton; 13 | Button2: TButton; 14 | Memo1: TMemo; 15 | procedure Button1Click(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | procedure Show (const Text: string); 20 | end; 21 | 22 | var 23 | Form1: TForm1; 24 | 25 | 26 | 27 | implementation 28 | 29 | {$R *.fmx} 30 | 31 | type 32 | MyInt = type Integer; 33 | 34 | TMyIntHelper = record helper for MyInt 35 | function AsString: string; 36 | end; 37 | 38 | procedure TForm1.Button1Click(Sender: TObject); 39 | var 40 | mi: MyInt; 41 | begin 42 | mi := 10; 43 | Show (mi.asString); 44 | //Show (mi.toString); 45 | Show (Integer(mi).ToString) 46 | end; 47 | 48 | procedure TForm1.Show(const Text: string); 49 | begin 50 | Memo1.Lines.Add (Text); 51 | end; 52 | 53 | { TMyIntHelper } 54 | 55 | function TMyIntHelper.AsString: string; 56 | begin 57 | Result := IntToStr (self); 58 | end; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /12/TypeAliasHelper/TypeAliasHelper.dpr: -------------------------------------------------------------------------------- 1 | program TypeAliasHelper; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | HelperForm in 'HelperForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /12/TypeAliasHelper/TypeAliasHelper.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/12/TypeAliasHelper/TypeAliasHelper.res -------------------------------------------------------------------------------- /13/ArcExperiments/ArcExperiments.dpr: -------------------------------------------------------------------------------- 1 | program ArcExperiments; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.Forms, 6 | ArcExperiments_MainForm in 'ArcExperiments_MainForm.pas' {Form3}, 7 | Arc_MoreClasses in 'Arc_MoreClasses.pas'; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm3, Form3); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /13/ArcExperiments/ArcExperiments.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/ArcExperiments/ArcExperiments.res -------------------------------------------------------------------------------- /13/ArcExperiments/ArcExperiments_MainForm.fmx: -------------------------------------------------------------------------------- 1 | object Form3: TForm3 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form3' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 1440 8 | FormFactor.Height = 900 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Position.X = 24.000000000000000000 13 | Position.Y = 16.000000000000000000 14 | Size.Width = 337.000000000000000000 15 | Size.Height = 41.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | Text = 'All Operations' 19 | OnClick = Button1Click 20 | end 21 | object Memo1: TMemo 22 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 23 | DataDetectorTypes = [] 24 | Position.X = 32.000000000000000000 25 | Position.Y = 128.000000000000000000 26 | Size.Width = 321.000000000000000000 27 | Size.Height = 409.000000000000000000 28 | Size.PlatformDefault = False 29 | TabOrder = 1 30 | Viewport.Width = 313.000000000000000000 31 | Viewport.Height = 401.000000000000000000 32 | end 33 | object Button2: TButton 34 | Position.X = 32.000000000000000000 35 | Position.Y = 72.000000000000000000 36 | Size.Width = 321.000000000000000000 37 | Size.Height = 44.000000000000000000 38 | Size.PlatformDefault = False 39 | TabOrder = 2 40 | Text = 'Weak' 41 | OnClick = Button2Click 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /13/FastMMCode_VCL/FastMM4.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/FastMMCode_VCL/FastMM4.pas -------------------------------------------------------------------------------- /13/FastMMCode_VCL/FastMMCode.dpr: -------------------------------------------------------------------------------- 1 | program FastMMCode; 2 | 3 | // warning: this program requires FastMM_FullDebugMode.dll 4 | 5 | uses 6 | FastMM4 in 'FastMM4.pas', 7 | Forms, 8 | FastMMForm in 'FastMMForm.pas'; {Form1} 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.Run; 16 | end. 17 | -------------------------------------------------------------------------------- /13/FastMMCode_VCL/FastMMCode.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/FastMMCode_VCL/FastMMCode.res -------------------------------------------------------------------------------- /13/FastMMCode_VCL/FastMMForm.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'FastMMCode' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object Button1: TButton 17 | Left = 40 18 | Top = 40 19 | Width = 75 20 | Height = 25 21 | Caption = 'Leak' 22 | TabOrder = 0 23 | OnClick = Button1Click 24 | end 25 | object Button2: TButton 26 | Left = 40 27 | Top = 88 28 | Width = 75 29 | Height = 25 30 | Caption = 'Overrun' 31 | TabOrder = 1 32 | OnClick = Button2Click 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /13/FastMMCode_VCL/FastMMForm.pas: -------------------------------------------------------------------------------- 1 | unit FastMMForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TForm1 = class(TForm) 11 | Button1: TButton; 12 | Button2: TButton; 13 | procedure Button1Click(Sender: TObject); 14 | procedure Button2Click(Sender: TObject); 15 | private 16 | { Private declarations } 17 | public 18 | { Public declarations } 19 | end; 20 | 21 | var 22 | Form1: TForm1; 23 | 24 | implementation 25 | 26 | {$R *.dfm} 27 | 28 | procedure TForm1.Button1Click(Sender: TObject); 29 | begin 30 | TButton.Create (nil); 31 | end; 32 | 33 | procedure TForm1.Button2Click(Sender: TObject); 34 | var 35 | pch1: PChar; 36 | begin 37 | GetMem (pch1, 5); 38 | GetWindowText(Handle, pch1, Length(Caption)); 39 | ShowMessage (pch1); 40 | FreeMem (pch1); 41 | end; 42 | 43 | initialization 44 | // ReportMemoryLeaksOnShutdown := True; 45 | // Win32MajorVersion 46 | end. 47 | -------------------------------------------------------------------------------- /13/LeakTest_VCL/LeakTest.dpr: -------------------------------------------------------------------------------- 1 | program LeakTest; 2 | 3 | uses 4 | Forms, 5 | LeakTestForm in 'LeakTestForm.pas' {FormLeakTest}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormLeakTest, FormLeakTest); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /13/LeakTest_VCL/LeakTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/LeakTest_VCL/LeakTest.res -------------------------------------------------------------------------------- /13/LeakTest_VCL/LeakTestForm.dfm: -------------------------------------------------------------------------------- 1 | object FormLeakTest: TFormLeakTest 2 | Left = 0 3 | Top = 0 4 | Caption = 'LeakTest' 5 | ClientHeight = 141 6 | ClientWidth = 274 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object Button1: TButton 18 | Left = 48 19 | Top = 32 20 | Width = 177 21 | Height = 25 22 | Caption = 'GetMem' 23 | TabOrder = 0 24 | OnClick = Button1Click 25 | end 26 | object Button2: TButton 27 | Left = 48 28 | Top = 72 29 | Width = 177 30 | Height = 25 31 | Caption = 'Create TButton' 32 | TabOrder = 1 33 | OnClick = Button2Click 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /13/LeakTest_VCL/LeakTestForm.pas: -------------------------------------------------------------------------------- 1 | unit LeakTestForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TFormLeakTest = class(TForm) 11 | Button1: TButton; 12 | Button2: TButton; 13 | procedure Button1Click(Sender: TObject); 14 | procedure Button2Click(Sender: TObject); 15 | procedure FormCreate(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | FormLeakTest: TFormLeakTest; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | var 30 | GlobalPointer: Pointer; 31 | 32 | procedure TFormLeakTest.Button1Click(Sender: TObject); 33 | var 34 | p: Pointer; 35 | begin 36 | GetMem (p, 100); 37 | end; 38 | 39 | procedure TFormLeakTest.Button2Click(Sender: TObject); 40 | begin 41 | TButton.Create (nil); 42 | end; 43 | 44 | procedure TFormLeakTest.FormCreate(Sender: TObject); 45 | begin 46 | // global allocation 47 | GetMem (GlobalPointer, 200); 48 | RegisterExpectedMemoryLeak(GlobalPointer); 49 | end; 50 | 51 | initialization 52 | ReportMemoryLeaksOnShutdown := True; 53 | end. 54 | -------------------------------------------------------------------------------- /13/SafeCode_VCL/SafeCode.dpr: -------------------------------------------------------------------------------- 1 | program SafeCode; 2 | 3 | uses 4 | Forms, 5 | SafeCodeMain in 'SafeCodeMain.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.CreateForm(TForm1, Form1); 12 | Application.Run; 13 | end. 14 | -------------------------------------------------------------------------------- /13/SafeCode_VCL/SafeCode.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/SafeCode_VCL/SafeCode.res -------------------------------------------------------------------------------- /13/SafeCode_VCL/SafeCodeMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'SafeCode' 5 | ClientHeight = 275 6 | ClientWidth = 549 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnConstructor: TButton 17 | Left = 24 18 | Top = 32 19 | Width = 153 20 | Height = 25 21 | Caption = 'Constructor Failure' 22 | TabOrder = 0 23 | OnClick = btnConstructorClick 24 | end 25 | object btnMixed: TButton 26 | Left = 24 27 | Top = 72 28 | Width = 153 29 | Height = 25 30 | Caption = 'Mixed Interfaces' 31 | TabOrder = 1 32 | OnClick = btnMixedClick 33 | end 34 | object btnRelease: TButton 35 | Left = 24 36 | Top = 112 37 | Width = 153 38 | Height = 25 39 | Caption = 'Extra Release' 40 | TabOrder = 2 41 | OnClick = btnReleaseClick 42 | end 43 | object btnCast: TButton 44 | Left = 24 45 | Top = 152 46 | Width = 153 47 | Height = 25 48 | Caption = 'Unsafe Cast' 49 | TabOrder = 3 50 | OnClick = btnCastClick 51 | end 52 | object btnTryF: TButton 53 | Left = 248 54 | Top = 32 55 | Width = 137 56 | Height = 25 57 | Caption = 'try-finally' 58 | TabOrder = 4 59 | OnClick = btnTryFClick 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /13/ShowMemory/ShowMemory.dpr: -------------------------------------------------------------------------------- 1 | program ShowMemory; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | ShowMemoryForm in 'ShowMemoryForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /13/ShowMemory/ShowMemory.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/13/ShowMemory/ShowMemory.res -------------------------------------------------------------------------------- /13/ShowMemory/ShowMemoryForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'ShowMemory' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Button1: TButton 12 | Align = Top 13 | Size.Width = 384.000000000000000000 14 | Size.Height = 44.000000000000000000 15 | Size.PlatformDefault = False 16 | TabOrder = 0 17 | Text = 'Get Memory Data' 18 | OnClick = Button1Click 19 | end 20 | object AniIndicator1: TAniIndicator 21 | Position.X = 168.000000000000000000 22 | Position.Y = 256.000000000000000000 23 | Visible = False 24 | end 25 | object Image2: TImage 26 | MultiResBitmap.Height = 256 27 | MultiResBitmap.Width = 256 28 | MultiResBitmap = < 29 | item 30 | end> 31 | Align = Client 32 | Size.Width = 384.000000000000000000 33 | Size.Height = 523.000000000000000000 34 | Size.PlatformDefault = False 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /14/ClassConstraint_VCL/ClassConstraint.dpr: -------------------------------------------------------------------------------- 1 | program ClassConstraint; 2 | 3 | uses 4 | Forms, 5 | ClassConstraint_MainForm in 'ClassConstraint_MainForm.pas' {Form30}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm30, Form30); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/ClassConstraint_VCL/ClassConstraint.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/ClassConstraint_VCL/ClassConstraint.res -------------------------------------------------------------------------------- /14/ClassConstraint_VCL/ClassConstraint_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form30: TForm30 2 | Left = 0 3 | Top = 0 4 | Caption = 'ClassContraint' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object Memo1: TMemo 17 | Left = 104 18 | Top = 8 19 | Width = 433 20 | Height = 273 21 | TabOrder = 0 22 | end 23 | object create: TButton 24 | Left = 8 25 | Top = 8 26 | Width = 75 27 | Height = 25 28 | Caption = 'create' 29 | TabOrder = 1 30 | OnClick = createClick 31 | end 32 | object wrong: TButton 33 | Left = 8 34 | Top = 40 35 | Width = 75 36 | Height = 25 37 | Caption = 'wrong' 38 | TabOrder = 2 39 | OnClick = wrongClick 40 | end 41 | object Button1: TButton 42 | Left = 8 43 | Top = 72 44 | Width = 75 45 | Height = 25 46 | Caption = 'virtual' 47 | TabOrder = 3 48 | OnClick = Button1Click 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /14/CovariantReturnTypes_VCL/Covariant.dpr: -------------------------------------------------------------------------------- 1 | program Covariant; 2 | 3 | uses 4 | Vcl.Forms, 5 | Covariant_MainForm in 'Covariant_MainForm.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm1, Form1); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/CovariantReturnTypes_VCL/Covariant.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/CovariantReturnTypes_VCL/Covariant.res -------------------------------------------------------------------------------- /14/CovariantReturnTypes_VCL/Covariant_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Covariant' 5 | ClientHeight = 470 6 | ClientWidth = 699 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -13 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 120 15 | TextHeight = 16 16 | object Button1: TButton 17 | Left = 24 18 | Top = 32 19 | Width = 75 20 | Height = 25 21 | Caption = 'animals' 22 | TabOrder = 0 23 | OnClick = Button1Click 24 | end 25 | object Memo1: TMemo 26 | Left = 120 27 | Top = 32 28 | Width = 537 29 | Height = 409 30 | TabOrder = 1 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /14/CustomerDictionary_VCL/CustomerDataModule.pas: -------------------------------------------------------------------------------- 1 | unit CustomerDataModule; 2 | 3 | interface 4 | 5 | uses 6 | SysUtils, Classes, DB, DBClient; 7 | 8 | type 9 | TDataModule1 = class(TDataModule) 10 | ClientDataSet1: TClientDataSet; 11 | ClientDataSet1CustNo: TFloatField; 12 | ClientDataSet1Company: TStringField; 13 | ClientDataSet1Addr1: TStringField; 14 | ClientDataSet1Addr2: TStringField; 15 | ClientDataSet1City: TStringField; 16 | ClientDataSet1State: TStringField; 17 | ClientDataSet1Zip: TStringField; 18 | ClientDataSet1Country: TStringField; 19 | ClientDataSet1Phone: TStringField; 20 | ClientDataSet1FAX: TStringField; 21 | ClientDataSet1TaxRate: TFloatField; 22 | ClientDataSet1Contact: TStringField; 23 | ClientDataSet1LastInvoiceDate: TDateTimeField; 24 | private 25 | { Private declarations } 26 | public 27 | { Public declarations } 28 | end; 29 | 30 | var 31 | DataModule1: TDataModule1; 32 | 33 | implementation 34 | 35 | {$R *.dfm} 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /14/CustomerDictionary_VCL/CustomerDictionary.dpr: -------------------------------------------------------------------------------- 1 | program CustomerDictionary; 2 | 3 | uses 4 | Forms, 5 | CustomerDictionary_MainForm in 'CustomerDictionary_MainForm.pas' {FormCustomerDictionary}, 6 | CustomerClasses in 'CustomerClasses.pas', 7 | CustomerDataModule in 'CustomerDataModule.pas' {DataModule1: TDataModule}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.MainFormOnTaskbar := True; 14 | Application.CreateForm(TFormCustomerDictionary, FormCustomerDictionary); 15 | Application.CreateForm(TDataModule1, DataModule1); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /14/CustomerDictionary_VCL/CustomerDictionary.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/CustomerDictionary_VCL/CustomerDictionary.res -------------------------------------------------------------------------------- /14/CustomerDictionary_VCL/CustomerDictionary_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormCustomerDictionary: TFormCustomerDictionary 2 | Left = 0 3 | Top = 0 4 | Caption = 'CustomerDictionary' 5 | ClientHeight = 322 6 | ClientWidth = 604 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object btnPopulate: TButton 18 | Left = 16 19 | Top = 8 20 | Width = 75 21 | Height = 25 22 | Caption = 'btnPopulate' 23 | TabOrder = 0 24 | OnClick = btnPopulateClick 25 | end 26 | object ListView1: TListView 27 | Left = 16 28 | Top = 39 29 | Width = 569 30 | Height = 266 31 | Columns = < 32 | item 33 | AutoSize = True 34 | Caption = 'Name' 35 | end 36 | item 37 | AutoSize = True 38 | Caption = 'ID' 39 | end 40 | item 41 | AutoSize = True 42 | Caption = 'Country' 43 | end> 44 | TabOrder = 1 45 | ViewStyle = vsReport 46 | OnSelectItem = ListView1SelectItem 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /14/CustomerDictionary_VCL/customer.cds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/CustomerDictionary_VCL/customer.cds -------------------------------------------------------------------------------- /14/GenericClassCtor_VCL/GenericClassCtor.dpr: -------------------------------------------------------------------------------- 1 | program GenericClassCtor; 2 | 3 | uses 4 | Forms, 5 | GenericClassCtor_MainForm in 'GenericClassCtor_MainForm.pas' {FormGenericClassCtor}, 6 | GenericClassCtor_Classes in 'GenericClassCtor_Classes.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TFormGenericClassCtor, FormGenericClassCtor); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/GenericClassCtor_VCL/GenericClassCtor.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/GenericClassCtor_VCL/GenericClassCtor.res -------------------------------------------------------------------------------- /14/GenericClassCtor_VCL/GenericClassCtor_Classes.pas: -------------------------------------------------------------------------------- 1 | unit GenericClassCtor_Classes; 2 | 3 | interface 4 | 5 | uses 6 | Classes; 7 | 8 | type 9 | TGenericWithClassCtor = class 10 | private 11 | FData: T; 12 | procedure SetData(const Value: T); 13 | public 14 | class constructor Create; 15 | property Data: T read FData write SetData; 16 | class var 17 | DataSize: Integer; 18 | end; 19 | 20 | function ListSequence: TStringList; 21 | 22 | // procedure Useless; // not really needed 23 | 24 | implementation 25 | 26 | var // one for the unit (shared by all geenrics) 27 | sListSequence: TStringList; 28 | 29 | function ListSequence: TStringList; 30 | begin 31 | if not Assigned (sListSequence) then 32 | sListSequence := TStringList.Create; 33 | Result := sListSequence; 34 | end; 35 | 36 | // uncomment to show a double initialization 37 | //procedure Useless; 38 | //var 39 | // genStr: TGenericWithClassCtor ; 40 | //begin 41 | // genStr := TGenericWithClassCtor .Create; 42 | // genStr.Data := '100'; 43 | // genStr.Free; 44 | //end; 45 | 46 | { TGenericWithClassCtor } 47 | 48 | class constructor TGenericWithClassCtor.Create; 49 | begin 50 | DataSize := SizeOf (T); 51 | ListSequence.Add(ClassName); 52 | end; 53 | 54 | procedure TGenericWithClassCtor.SetData(const Value: T); 55 | begin 56 | FData := Value; 57 | end; 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /14/GenericClassCtor_VCL/GenericClassCtor_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormGenericClassCtor: TFormGenericClassCtor 2 | Left = 0 3 | Top = 0 4 | Caption = 'GenericClassCtor' 5 | ClientHeight = 290 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnInt: TButton 17 | Left = 24 18 | Top = 16 19 | Width = 75 20 | Height = 25 21 | Caption = 'btnInt' 22 | TabOrder = 0 23 | OnClick = btnIntClick 24 | end 25 | object Memo1: TMemo 26 | Left = 120 27 | Top = 18 28 | Width = 417 29 | Height = 247 30 | TabOrder = 1 31 | end 32 | object btnString: TButton 33 | Left = 24 34 | Top = 48 35 | Width = 75 36 | Height = 25 37 | Caption = 'btnString' 38 | TabOrder = 2 39 | OnClick = btnStringClick 40 | end 41 | object btnSequence: TButton 42 | Left = 24 43 | Top = 232 44 | Width = 75 45 | Height = 25 46 | Caption = 'btnSequence' 47 | TabOrder = 3 48 | OnClick = btnSequenceClick 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /14/GenericInterface_VCL/GenericInterface.dpr: -------------------------------------------------------------------------------- 1 | program GenericInterface; 2 | 3 | uses 4 | Forms, 5 | GenericInterface_MainForm in 'GenericInterface_MainForm.pas' {FormGenericInterface}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormGenericInterface, FormGenericInterface); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/GenericInterface_VCL/GenericInterface.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/GenericInterface_VCL/GenericInterface.res -------------------------------------------------------------------------------- /14/GenericInterface_VCL/GenericInterface_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormGenericInterface: TFormGenericInterface 2 | Left = 0 3 | Top = 0 4 | Caption = 'GenericInterface' 5 | ClientHeight = 292 6 | ClientWidth = 570 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnValue: TButton 17 | Left = 16 18 | Top = 8 19 | Width = 97 20 | Height = 25 21 | Caption = 'btnValue' 22 | TabOrder = 0 23 | OnClick = btnValueClick 24 | end 25 | object Memo1: TMemo 26 | Left = 128 27 | Top = 8 28 | Width = 241 29 | Height = 276 30 | TabOrder = 1 31 | end 32 | object btnValueButton: TButton 33 | Left = 16 34 | Top = 104 35 | Width = 97 36 | Height = 25 37 | Caption = 'btnValueButton' 38 | TabOrder = 2 39 | OnClick = btnValueButtonClick 40 | end 41 | object btnIValue: TButton 42 | Left = 16 43 | Top = 40 44 | Width = 97 45 | Height = 25 46 | Caption = 'btnIValue' 47 | TabOrder = 3 48 | OnClick = btnIValueClick 49 | end 50 | object ScrollBox1: TScrollBox 51 | Left = 376 52 | Top = 8 53 | Width = 185 54 | Height = 276 55 | TabOrder = 4 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /14/GenericMethod/GenericForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | Align = Client 14 | Size.Width = 384.000000000000000000 15 | Size.Height = 479.000000000000000000 16 | Size.PlatformDefault = False 17 | TabOrder = 0 18 | end 19 | object Button1: TButton 20 | Align = Top 21 | Size.Width = 384.000000000000000000 22 | Size.Height = 44.000000000000000000 23 | Size.PlatformDefault = False 24 | TabOrder = 1 25 | Text = 'Correct Calls' 26 | OnClick = Button1Click 27 | end 28 | object Button2: TButton 29 | Align = Top 30 | Position.Y = 44.000000000000000000 31 | Size.Width = 384.000000000000000000 32 | Size.Height = 44.000000000000000000 33 | Size.PlatformDefault = False 34 | TabOrder = 2 35 | Text = 'Wrong Calls' 36 | OnClick = Button2Click 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /14/GenericMethod/GenericMethod.dpr: -------------------------------------------------------------------------------- 1 | program GenericMethod; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | GenericForm in 'GenericForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/GenericMethod/GenericMethod.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/GenericMethod/GenericMethod.res -------------------------------------------------------------------------------- /14/GenericTypeFunc_VCL/GenericTypeFunc.dpr: -------------------------------------------------------------------------------- 1 | program GenericTypeFunc; 2 | 3 | uses 4 | Forms, 5 | GenericTypeFunc_MainForm in 'GenericTypeFunc_MainForm.pas' {Form30}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm30, Form30); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/GenericTypeFunc_VCL/GenericTypeFunc.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/GenericTypeFunc_VCL/GenericTypeFunc.res -------------------------------------------------------------------------------- /14/GenericTypeFunc_VCL/GenericTypeFunc_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form30: TForm30 2 | Left = 0 3 | Top = 0 4 | Caption = 'GenericTypeFunc' 5 | ClientHeight = 315 6 | ClientWidth = 537 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnShowInfo: TButton 17 | Left = 8 18 | Top = 8 19 | Width = 97 20 | Height = 25 21 | Caption = 'btnShowInfo' 22 | TabOrder = 0 23 | OnClick = btnShowInfoClick 24 | end 25 | object Memo1: TMemo 26 | Left = 111 27 | Top = 8 28 | Width = 418 29 | Height = 299 30 | TabOrder = 1 31 | end 32 | object btnExperiments: TButton 33 | Left = 8 34 | Top = 39 35 | Width = 97 36 | Height = 25 37 | Caption = 'btnExperiments' 38 | TabOrder = 2 39 | OnClick = btnExperimentsClick 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /14/IntfConstraint_VCL/IntfConstraint.dpr: -------------------------------------------------------------------------------- 1 | program IntfConstraint; 2 | 3 | uses 4 | Forms, 5 | IntfConstraint_MainForm in 'IntfConstraint_MainForm.pas' {FormIntfConstraint}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormIntfConstraint, FormIntfConstraint); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/IntfConstraint_VCL/IntfConstraint.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/IntfConstraint_VCL/IntfConstraint.res -------------------------------------------------------------------------------- /14/KeyValueClassic_VCL/KeyValueClassic.dpr: -------------------------------------------------------------------------------- 1 | program KeyValueClassic; 2 | 3 | uses 4 | Forms, 5 | KeyValueForm in 'KeyValueForm.pas' {Form2}, 6 | KeyValueCode in 'KeyValueCode.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TForm2, Form2); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/KeyValueClassic_VCL/KeyValueClassic.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/KeyValueClassic_VCL/KeyValueClassic.res -------------------------------------------------------------------------------- /14/KeyValueClassic_VCL/KeyValueCode.pas: -------------------------------------------------------------------------------- 1 | unit KeyValueCode; 2 | 3 | interface 4 | 5 | type 6 | TKeyValue = class 7 | private 8 | FKey: string; 9 | FValue: TObject; 10 | procedure SetKey(const Value: string); 11 | procedure SetValue(const Value: TObject); 12 | public 13 | property Key: string read FKey write SetKey; 14 | property Value: TObject read FValue write SetValue; 15 | end; 16 | 17 | implementation 18 | 19 | { TKeyValue } 20 | 21 | procedure TKeyValue.SetKey(const Value: string); 22 | begin 23 | FKey := Value; 24 | end; 25 | 26 | procedure TKeyValue.SetValue(const Value: TObject); 27 | begin 28 | FValue := Value; 29 | end; 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /14/KeyValueClassic_VCL/KeyValueForm.dfm: -------------------------------------------------------------------------------- 1 | object Form2: TForm2 2 | Left = 0 3 | Top = 0 4 | Caption = 'KeyValue' 5 | ClientHeight = 273 6 | ClientWidth = 393 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | OnDestroy = FormDestroy 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Button1: TButton 19 | Left = 32 20 | Top = 32 21 | Width = 113 22 | Height = 25 23 | Caption = 'Set KeyValue' 24 | TabOrder = 0 25 | OnClick = Button1Click 26 | end 27 | object Button2: TButton 28 | Left = 32 29 | Top = 64 30 | Width = 113 31 | Height = 25 32 | Caption = 'Change Value' 33 | TabOrder = 1 34 | OnClick = Button2Click 35 | end 36 | object Button3: TButton 37 | Left = 32 38 | Top = 96 39 | Width = 113 40 | Height = 25 41 | Caption = 'Get KeyValue' 42 | TabOrder = 2 43 | OnClick = Button3Click 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /14/KeyValueClassic_VCL/KeyValueForm.pas: -------------------------------------------------------------------------------- 1 | unit KeyValueForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls, KeyValueCode; 8 | 9 | type 10 | TForm2 = class(TForm) 11 | Button1: TButton; 12 | Button2: TButton; 13 | Button3: TButton; 14 | procedure Button1Click(Sender: TObject); 15 | procedure FormCreate(Sender: TObject); 16 | procedure FormDestroy(Sender: TObject); 17 | procedure Button2Click(Sender: TObject); 18 | procedure Button3Click(Sender: TObject); 19 | private 20 | kv: TKeyValue; 21 | public 22 | { Public declarations } 23 | end; 24 | 25 | var 26 | Form2: TForm2; 27 | 28 | implementation 29 | 30 | {$R *.dfm} 31 | 32 | procedure TForm2.Button1Click(Sender: TObject); 33 | begin 34 | kv.Key := 'mykey'; 35 | kv.Value := Sender; 36 | end; 37 | 38 | procedure TForm2.Button2Click(Sender: TObject); 39 | begin 40 | kv.Value := self; // the form 41 | end; 42 | 43 | procedure TForm2.Button3Click(Sender: TObject); 44 | begin 45 | ShowMessage ('[' + kv.Key + ',' + kv.Value.ClassName + ']'); 46 | end; 47 | 48 | procedure TForm2.FormCreate(Sender: TObject); 49 | begin 50 | kv := TKeyValue.Create; 51 | end; 52 | 53 | procedure TForm2.FormDestroy(Sender: TObject); 54 | begin 55 | kv.Free; 56 | end; 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /14/KeyValueGeneric_VCL/KeyValueCode.pas: -------------------------------------------------------------------------------- 1 | unit KeyValueCode; 2 | 3 | interface 4 | 5 | type 6 | TKeyValue = class 7 | private 8 | FKey: string; 9 | FValue: T; 10 | procedure SetKey(const Value: string); 11 | procedure SetValue(const Value: T); 12 | public 13 | procedure DoSomething; 14 | property Key: string read FKey write SetKey; 15 | property Value: T read FValue write SetValue; 16 | end; 17 | 18 | implementation 19 | 20 | { TKeyValue } 21 | 22 | procedure TKeyValue.DoSomething; 23 | begin 24 | 25 | end; 26 | 27 | procedure TKeyValue.SetKey(const Value: string); 28 | begin 29 | FKey := Value; 30 | end; 31 | 32 | procedure TKeyValue.SetValue(const Value: T); 33 | begin 34 | FValue := Value; 35 | end; 36 | 37 | end. 38 | -------------------------------------------------------------------------------- /14/KeyValueGeneric_VCL/KeyValueGeneric.dpr: -------------------------------------------------------------------------------- 1 | program KeyValueGeneric; 2 | 3 | uses 4 | Forms, 5 | KeyValueForm in 'KeyValueForm.pas' {Form2}, 6 | KeyValueCode in 'KeyValueCode.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TForm2, Form2); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/KeyValueGeneric_VCL/KeyValueGeneric.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/KeyValueGeneric_VCL/KeyValueGeneric.res -------------------------------------------------------------------------------- /14/ListDemoMD2005_VCL/ListDemoMd2005.dpr: -------------------------------------------------------------------------------- 1 | program ListDemoMd2005; 2 | 3 | uses 4 | Forms, 5 | ListForm in 'ListForm.pas' {Form1}, 6 | Dates in 'Dates.pas'; 7 | 8 | {$R *.RES} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.CreateForm(TForm1, Form1); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/ListDemoMD2005_VCL/ListDemoMd2005.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/ListDemoMD2005_VCL/ListDemoMd2005.res -------------------------------------------------------------------------------- /14/ListDemoMD2005_VCL/ListForm.dfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/ListDemoMD2005_VCL/ListForm.dfm -------------------------------------------------------------------------------- /14/SmartPointers_VCL/SmartPointers.dpr: -------------------------------------------------------------------------------- 1 | program SmartPointers; 2 | 3 | uses 4 | Forms, 5 | SmartPointers_MainForm in 'SmartPointers_MainForm.pas' {FormSmartPointers}, 6 | SmartPointerClass in 'SmartPointerClass.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TFormSmartPointers, FormSmartPointers); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/SmartPointers_VCL/SmartPointers.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/SmartPointers_VCL/SmartPointers.res -------------------------------------------------------------------------------- /14/SmartPointers_VCL/SmartPointers_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormSmartPointers: TFormSmartPointers 2 | Left = 0 3 | Top = 0 4 | Caption = 'SmartPointers' 5 | ClientHeight = 361 6 | ClientWidth = 525 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnLeak: TButton 17 | Left = 72 18 | Top = 30 19 | Width = 113 20 | Height = 25 21 | Caption = 'btnLeak' 22 | TabOrder = 0 23 | OnClick = btnLeakClick 24 | end 25 | object btnSmart: TButton 26 | Left = 72 27 | Top = 72 28 | Width = 113 29 | Height = 25 30 | Caption = 'btnSmart' 31 | TabOrder = 1 32 | OnClick = btnSmartClick 33 | end 34 | object btnSmartShort: TButton 35 | Left = 72 36 | Top = 112 37 | Width = 113 38 | Height = 25 39 | Caption = 'btnSmartShort' 40 | TabOrder = 2 41 | OnClick = btnSmartShortClick 42 | end 43 | object btnImplicitCreate: TButton 44 | Left = 72 45 | Top = 152 46 | Width = 113 47 | Height = 25 48 | Caption = 'btnImplicitCreate' 49 | TabOrder = 3 50 | OnClick = btnImplicitCreateClick 51 | end 52 | object Memo1: TMemo 53 | Left = 232 54 | Top = 32 55 | Width = 249 56 | Height = 289 57 | TabOrder = 4 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /14/StringListVsDictionary_VCL/StringListVsDictionary.dpr: -------------------------------------------------------------------------------- 1 | program StringListVsDictionary; 2 | 3 | uses 4 | Vcl.Forms, 5 | ListDictionary_MainForm in 'ListDictionary_MainForm.pas' {FormLists}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormLists, FormLists); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /14/StringListVsDictionary_VCL/StringListVsDictionary.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/StringListVsDictionary_VCL/StringListVsDictionary.res -------------------------------------------------------------------------------- /14/TypeCompRules_VCL/TypeCompRules.dpr: -------------------------------------------------------------------------------- 1 | program TypeCompRules; 2 | 3 | uses 4 | Forms, 5 | TypeCompRules_MainForm in 'TypeCompRules_MainForm.pas' {Form30}, 6 | TypeCompRules_OtherUnit in 'TypeCompRules_OtherUnit.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TForm30, Form30); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /14/TypeCompRules_VCL/TypeCompRules.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/14/TypeCompRules_VCL/TypeCompRules.res -------------------------------------------------------------------------------- /14/TypeCompRules_VCL/TypeCompRules_OtherUnit.pas: -------------------------------------------------------------------------------- 1 | unit TypeCompRules_OtherUnit; 2 | 3 | interface 4 | 5 | uses 6 | TypeCompRules_MainForm; 7 | 8 | type 9 | TAntoherIntGenericArray = TGenericArray; 10 | 11 | implementation 12 | 13 | end. 14 | -------------------------------------------------------------------------------- /15/AnonAjax_VCL/AnonAjax.dpr: -------------------------------------------------------------------------------- 1 | program AnonAjax; 2 | 3 | uses 4 | Forms, 5 | AnonAjax_MainForm in 'AnonAjax_MainForm.pas' {FormAnonAjax}, 6 | AnonAjax_Thread in 'AnonAjax_Thread.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TFormAnonAjax, FormAnonAjax); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /15/AnonAjax_VCL/AnonAjax.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/AnonAjax_VCL/AnonAjax.res -------------------------------------------------------------------------------- /15/AnonButton/AnonButton.dpr: -------------------------------------------------------------------------------- 1 | program AnonButton; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | AnonButtonForm in 'AnonButtonForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /15/AnonButton/AnonButton.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/AnonButton/AnonButton.res -------------------------------------------------------------------------------- /15/AnonLargeString/AnonLargeString.dpr: -------------------------------------------------------------------------------- 1 | program AnonLargeString; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | LargeStringForm in 'LargeStringForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /15/AnonLargeString/AnonLargeString.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/AnonLargeString/AnonLargeString.res -------------------------------------------------------------------------------- /15/AnonLargeString/LargeStringForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object Memo1: TMemo 12 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 13 | DataDetectorTypes = [] 14 | Align = Client 15 | Size.Width = 384.000000000000000000 16 | Size.Height = 479.000000000000000000 17 | Size.PlatformDefault = False 18 | TabOrder = 0 19 | Viewport.Width = 376.000000000000000000 20 | Viewport.Height = 471.000000000000000000 21 | end 22 | object Button1: TButton 23 | Align = Top 24 | Size.Width = 384.000000000000000000 25 | Size.Height = 44.000000000000000000 26 | Size.PlatformDefault = False 27 | TabOrder = 1 28 | Text = 'Concatenate' 29 | OnClick = Button1Click 30 | end 31 | object Button2: TButton 32 | Align = Top 33 | Position.Y = 44.000000000000000000 34 | Size.Width = 384.000000000000000000 35 | Size.Height = 44.000000000000000000 36 | Size.PlatformDefault = False 37 | TabOrder = 2 38 | Text = 'StringBuilder' 39 | OnClick = Button2Click 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /15/AnonymFirst_VCL/AnonymFirst.dpr: -------------------------------------------------------------------------------- 1 | program AnonymFirst; 2 | 3 | uses 4 | Forms, 5 | AnonymFirst_MainForm in 'AnonymFirst_MainForm.pas' {FormAnonymFirst}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormAnonymFirst, FormAnonymFirst); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /15/AnonymFirst_VCL/AnonymFirst.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/AnonymFirst_VCL/AnonymFirst.res -------------------------------------------------------------------------------- /15/WebFind_VCL/WebFind.dpr: -------------------------------------------------------------------------------- 1 | program WebFind; 2 | 3 | uses 4 | Forms, 5 | WebFindF in 'WebFindF.pas' {Form1}, 6 | FindTh in 'FindTh.pas'; 7 | 8 | {$R *.RES} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.CreateForm(TForm1, Form1); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /15/WebFind_VCL/WebFind.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/WebFind_VCL/WebFind.res -------------------------------------------------------------------------------- /15/WebFind_VCL/WebFindF.dfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/15/WebFind_VCL/WebFindF.dfm -------------------------------------------------------------------------------- /16/DescriptionAttribute_VCL/DescriptionAttribute.dpr: -------------------------------------------------------------------------------- 1 | program DescriptionAttribute; 2 | 3 | uses 4 | Forms, 5 | DescriptionAttribute_MainForm in 'DescriptionAttribute_MainForm.pas' {FormDescrAttr}, 6 | DescriptionAttribute_Classes in 'DescriptionAttribute_Classes.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TFormDescrAttr, FormDescrAttr); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /16/DescriptionAttribute_VCL/DescriptionAttribute.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/DescriptionAttribute_VCL/DescriptionAttribute.res -------------------------------------------------------------------------------- /16/DescriptionAttribute_VCL/DescriptionAttribute_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormDescrAttr: TFormDescrAttr 2 | Left = 0 3 | Top = 0 4 | Caption = 'DescriptionAttributes' 5 | ClientHeight = 201 6 | ClientWidth = 578 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object ListView1: TListView 18 | Left = 24 19 | Top = 16 20 | Width = 537 21 | Height = 169 22 | Columns = < 23 | item 24 | Caption = 'ID' 25 | Width = 150 26 | end 27 | item 28 | AutoSize = True 29 | Caption = 'Description' 30 | end> 31 | TabOrder = 0 32 | ViewStyle = vsReport 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /16/InterceptBaseClass_VCL/InterceptBaseClass.dpr: -------------------------------------------------------------------------------- 1 | program InterceptBaseClass; 2 | 3 | uses 4 | Forms, 5 | InterceptBaseClass_MainForm in 'InterceptBaseClass_MainForm.pas' {FormIntercept}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormIntercept, FormIntercept); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /16/InterceptBaseClass_VCL/InterceptBaseClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/InterceptBaseClass_VCL/InterceptBaseClass.res -------------------------------------------------------------------------------- /16/RttiAccess/RttiAccess.dpr: -------------------------------------------------------------------------------- 1 | program RttiAccess; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | RttiForm in 'RttiForm.pas' {Form1}; 8 | 9 | {$R *.res} 10 | 11 | begin 12 | Application.Initialize; 13 | Application.CreateForm(TForm1, Form1); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /16/RttiAccess/RttiAccess.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/RttiAccess/RttiAccess.res -------------------------------------------------------------------------------- /16/RttiAccess/RttiForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'TypesList' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object btnReadValues: TButton 12 | Align = Top 13 | Size.Width = 384.000000000000000000 14 | Size.Height = 44.000000000000000000 15 | Size.PlatformDefault = False 16 | TabOrder = 1 17 | Text = 'Read Values' 18 | OnClick = btnReadValuesClick 19 | end 20 | object btnInvoke: TButton 21 | Align = Top 22 | Position.Y = 44.000000000000000000 23 | Size.Width = 384.000000000000000000 24 | Size.Height = 44.000000000000000000 25 | Size.PlatformDefault = False 26 | TabOrder = 0 27 | Text = 'Invoke' 28 | OnClick = btnInvokeClick 29 | end 30 | object Memo1: TMemo 31 | Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] 32 | Align = Client 33 | Size.Width = 384.000000000000000000 34 | Size.Height = 479.000000000000000000 35 | Size.PlatformDefault = False 36 | TabOrder = 2 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /16/RttiAttrib_VCL/RttiAttrib.dpr: -------------------------------------------------------------------------------- 1 | program RttiAttrib; 2 | 3 | uses 4 | Forms, 5 | RttiAttribMainForm in 'RttiAttribMainForm.pas' {Form39}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm39, Form39); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /16/RttiAttrib_VCL/RttiAttrib.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/RttiAttrib_VCL/RttiAttrib.res -------------------------------------------------------------------------------- /16/RttiAttrib_VCL/RttiAttribMainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form39: TForm39 2 | Left = 0 3 | Top = 0 4 | Caption = 'RttiAttrib' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnMethods: TButton 17 | Left = 26 18 | Top = 76 19 | Width = 105 20 | Height = 25 21 | Caption = 'btnMethods' 22 | TabOrder = 0 23 | OnClick = btnMethodsClick 24 | end 25 | object Memo1: TMemo 26 | Left = 152 27 | Top = 26 28 | Width = 385 29 | Height = 239 30 | TabOrder = 1 31 | end 32 | object btnClassAttribs: TButton 33 | Left = 26 34 | Top = 24 35 | Width = 105 36 | Height = 25 37 | Caption = 'btnClassAttribs' 38 | TabOrder = 2 39 | OnClick = btnClassAttribsClick 40 | end 41 | object btnInvokeIfZero: TButton 42 | Left = 26 43 | Top = 128 44 | Width = 105 45 | Height = 25 46 | Caption = 'btnInvokeIfZero' 47 | TabOrder = 3 48 | OnClick = btnInvokeIfZeroClick 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /16/RttiIntro_VCL/RttiIntro.dpr: -------------------------------------------------------------------------------- 1 | program RttiIntro; 2 | 3 | uses 4 | Forms, 5 | RttiIntro_MainForm in 'RttiIntro_MainForm.pas' {FormRttiIntro}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormRttiIntro, FormRttiIntro); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /16/RttiIntro_VCL/RttiIntro.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/RttiIntro_VCL/RttiIntro.res -------------------------------------------------------------------------------- /16/RttiIntro_VCL/RttiIntro_MainForm.pas: -------------------------------------------------------------------------------- 1 | unit RttiIntro_MainForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TFormRttiIntro = class(TForm) 11 | btnInfo: TButton; 12 | Memo1: TMemo; 13 | btnChange: TButton; 14 | Edit1: TEdit; 15 | procedure btnInfoClick(Sender: TObject); 16 | procedure btnChangeClick(Sender: TObject); 17 | private 18 | { Private declarations } 19 | public 20 | procedure Log (const strMsg: string); 21 | end; 22 | 23 | var 24 | FormRttiIntro: TFormRttiIntro; 25 | 26 | implementation 27 | 28 | {$R *.dfm} 29 | 30 | uses 31 | Rtti; 32 | 33 | 34 | procedure TFormRttiIntro.btnChangeClick(Sender: TObject); 35 | var 36 | context: TRttiContext; 37 | aProp: TRttiProperty; 38 | begin 39 | aProp := context.GetType(TButton).GetProperty('Caption'); 40 | if Assigned (aProp) then 41 | aProp.SetValue(btnChange, StringOfChar ('*', random (10) + 1)); 42 | end; 43 | 44 | procedure TFormRttiIntro.btnInfoClick(Sender: TObject); 45 | var 46 | context: TRttiContext; 47 | begin 48 | Log (context. 49 | GetType(TButton). 50 | GetProperty(Edit1.Text). 51 | GetValue(Sender).ToString); 52 | end; 53 | 54 | procedure TFormRttiIntro.Log(const strMsg: string); 55 | begin 56 | Memo1.Lines.Add (strMsg); 57 | end; 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /16/TValueTest_VCL/TValueTest.dpr: -------------------------------------------------------------------------------- 1 | program TValueTest; 2 | 3 | uses 4 | Forms, 5 | TValueTestMainForm in 'TValueTestMainForm.pas' {Form39}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm39, Form39); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /16/TValueTest_VCL/TValueTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/TValueTest_VCL/TValueTest.res -------------------------------------------------------------------------------- /16/TValueTest_VCL/TValueTestMainForm.dfm: -------------------------------------------------------------------------------- 1 | object Form39: TForm39 2 | Left = 0 3 | Top = 0 4 | Caption = 'TValueTest' 5 | ClientHeight = 292 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnNoConvert: TButton 17 | Left = 8 18 | Top = 14 19 | Width = 105 20 | Height = 25 21 | Caption = 'btnNoConvert' 22 | TabOrder = 0 23 | OnClick = btnNoConvertClick 24 | end 25 | object Memo1: TMemo 26 | Left = 128 27 | Top = 16 28 | Width = 409 29 | Height = 257 30 | TabOrder = 1 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /16/TValueTest_VCL/TValueTestMainForm.pas: -------------------------------------------------------------------------------- 1 | unit TValueTestMainForm; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 | Dialogs, StdCtrls; 8 | 9 | type 10 | TForm39 = class(TForm) 11 | btnNoConvert: TButton; 12 | Memo1: TMemo; 13 | procedure btnNoConvertClick(Sender: TObject); 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | procedure Log (const strMsg: string); 19 | end; 20 | 21 | var 22 | Form39: TForm39; 23 | 24 | implementation 25 | 26 | {$R *.dfm} 27 | 28 | uses 29 | Rtti; 30 | 31 | procedure TForm39.btnNoConvertClick(Sender: TObject); 32 | var 33 | v1: TValue; 34 | begin 35 | //v1 := 100; 36 | v1 := TValue.From(100); 37 | if v1.IsOrdinal then 38 | Log (IntToStr (v1.AsInteger)); 39 | if v1.IsType then 40 | Log (v1.AsString); 41 | Log (v1.ToString); 42 | end; 43 | 44 | procedure TForm39.Log(const strMsg: string); 45 | begin 46 | Memo1.Lines.Add (strMsg); 47 | end; 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /16/TypesList/TypesForm.fmx: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'TypesList' 5 | ClientHeight = 567 6 | ClientWidth = 384 7 | FormFactor.Width = 320 8 | FormFactor.Height = 480 9 | FormFactor.Devices = [Desktop] 10 | DesignerMasterStyle = 3 11 | object btnTypesList: TButton 12 | Align = Top 13 | Size.Width = 384.000000000000000000 14 | Size.Height = 44.000000000000000000 15 | Size.PlatformDefault = False 16 | TabOrder = 0 17 | Text = 'Types List' 18 | OnClick = btnTypesListClick 19 | end 20 | object ListView1: TListView 21 | ItemAppearanceClassName = 'TListItemAppearance' 22 | ItemEditAppearanceClassName = 'TListItemShowCheckAppearance' 23 | HeaderAppearanceClassName = 'TListHeaderObjects' 24 | FooterAppearanceClassName = 'TListHeaderObjects' 25 | Align = Client 26 | Size.Width = 384.000000000000000000 27 | Size.Height = 523.000000000000000000 28 | Size.PlatformDefault = False 29 | TabOrder = 1 30 | OnItemClick = ListView1ItemClick 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /16/TypesList/TypesList.dpr: -------------------------------------------------------------------------------- 1 | program TypesList; 2 | 3 | uses 4 | System.StartUpCopy, 5 | FMX.MobilePreview, 6 | FMX.Forms, 7 | TypesForm in 'TypesForm.pas' {Form1}, 8 | TypeInfoForm in 'TypeInfoForm.pas' {FormTypeInfo}; 9 | 10 | {$R *.res} 11 | 12 | begin 13 | Application.Initialize; 14 | Application.CreateForm(TForm1, Form1); 15 | Application.CreateForm(TFormTypeInfo, FormTypeInfo); 16 | Application.Run; 17 | end. 18 | -------------------------------------------------------------------------------- /16/TypesList/TypesList.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/TypesList/TypesList.res -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersist.dpr: -------------------------------------------------------------------------------- 1 | program XmlPersist; 2 | 3 | uses 4 | Forms, 5 | XmlPersist_MainForm in 'XmlPersist_MainForm.pas' {FormXmlPersist}, 6 | XmlPersistAttrib_Classes in 'XmlPersistAttrib_Classes.pas', 7 | TrivialXmlWriter in 'TrivialXmlWriter.pas', 8 | XmlPersistPublish_Classes in 'XmlPersistPublish_Classes.pas', 9 | XmlPersistRtti_Classes in 'XmlPersistRtti_Classes.pas'; 10 | 11 | {$R *.res} 12 | 13 | begin 14 | Application.Initialize; 15 | Application.MainFormOnTaskbar := True; 16 | Application.CreateForm(TFormXmlPersist, FormXmlPersist); 17 | Application.Run; 18 | end. 19 | -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersist.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/16/XmlPersist_VCL/XmlPersist.res -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersistAttrib_Classes.pas: -------------------------------------------------------------------------------- 1 | unit XmlPersistAttrib_Classes; 2 | 3 | interface 4 | 5 | uses 6 | Classes, TrivialXmlWriter; 7 | 8 | type 9 | TAttrPerson = class 10 | private 11 | [xml ('Name')] 12 | FName: string; 13 | [xml] 14 | FCountry: string; 15 | published 16 | property Name: string read FName write FName; 17 | property Country: string read FCountry write FCountry; 18 | end; 19 | 20 | TAttrCompany = class 21 | private 22 | [xml ('CompanyName')] 23 | FName: string; 24 | [xml ('Country')] 25 | FCountry: string; 26 | FID: string; // omitted 27 | [xml ('TheBoss')] 28 | FPerson: TAttrPerson; 29 | published 30 | property Name: string read FName write FName; 31 | property Country: string read FCountry write FCountry; 32 | property ID: string read FID write FID; 33 | property Boss: TAttrPerson read FPerson write FPerson; 34 | end; 35 | 36 | implementation 37 | 38 | end. 39 | -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersistPublish_Classes.pas: -------------------------------------------------------------------------------- 1 | unit XmlPersistPublish_Classes; 2 | 3 | interface 4 | 5 | uses 6 | Classes; 7 | 8 | type 9 | TPerson = class (TPersistent) 10 | private 11 | FName: string; 12 | FCountry: string; 13 | published 14 | property Name: string read FName write FName; 15 | property Country: string read FCountry write FCountry; 16 | end; 17 | 18 | TCompany = class (TPersistent) 19 | private 20 | FName: string; 21 | FCountry: string; 22 | FID: string; 23 | FPerson: TPerson; 24 | published 25 | property Name: string read FName write FName; 26 | property Country: string read FCountry write FCountry; 27 | property ID: string read FID write FID; 28 | property Boss: TPerson read FPerson write FPerson; 29 | end; 30 | 31 | 32 | implementation 33 | 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersistRtti_Classes.pas: -------------------------------------------------------------------------------- 1 | unit XmlPersistRtti_Classes; 2 | 3 | interface 4 | 5 | uses 6 | Classes; 7 | 8 | type 9 | TNewPerson = class 10 | private 11 | FName: string; 12 | FCountry: string; 13 | published 14 | property Name: string read FName write FName; 15 | property Country: string read FCountry write FCountry; 16 | end; 17 | 18 | TNewCompany = class 19 | private 20 | FName: string; 21 | FCountry: string; 22 | FID: string; 23 | FPerson: TNewPerson; 24 | published 25 | property Name: string read FName write FName; 26 | property Country: string read FCountry write FCountry; 27 | property ID: string read FID write FID; 28 | property Boss: TNewPerson read FPerson write FPerson; 29 | end; 30 | 31 | implementation 32 | 33 | end. 34 | -------------------------------------------------------------------------------- /16/XmlPersist_VCL/XmlPersist_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormXmlPersist: TFormXmlPersist 2 | Left = 0 3 | Top = 0 4 | Caption = 'XmlPersist' 5 | ClientHeight = 290 6 | ClientWidth = 554 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object btnPublished: TButton 17 | Left = 8 18 | Top = 8 19 | Width = 129 20 | Height = 25 21 | Caption = 'btnPublished' 22 | TabOrder = 0 23 | OnClick = btnPublishedClick 24 | end 25 | object Memo1: TMemo 26 | Left = 168 27 | Top = 8 28 | Width = 378 29 | Height = 274 30 | Lines.Strings = ( 31 | 'Memo1') 32 | TabOrder = 1 33 | end 34 | object btnRtti: TButton 35 | Left = 8 36 | Top = 48 37 | Width = 129 38 | Height = 25 39 | Caption = 'btnRtti' 40 | TabOrder = 2 41 | OnClick = btnRttiClick 42 | end 43 | object btnAttributes: TButton 44 | Left = 8 45 | Top = 88 46 | Width = 129 47 | Height = 25 48 | Caption = 'btnAttributes' 49 | TabOrder = 3 50 | OnClick = btnAttributesClick 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /17/SystemObject_VCL/SystemObject.dpr: -------------------------------------------------------------------------------- 1 | program SystemObject; 2 | 3 | uses 4 | Forms, 5 | SystemObject_MainForm in 'SystemObject_MainForm.pas' {FormSystemObject}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormSystemObject, FormSystemObject); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /17/SystemObject_VCL/SystemObject.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/17/SystemObject_VCL/SystemObject.res -------------------------------------------------------------------------------- /18/BinaryFiles_VCL/BinaryFiles.dpr: -------------------------------------------------------------------------------- 1 | program BinaryFiles; 2 | 3 | uses 4 | Forms, 5 | BinaryFiles_MainForm in 'BinaryFiles_MainForm.pas' {FormBinary}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormBinary, FormBinary); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /18/BinaryFiles_VCL/BinaryFiles.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/18/BinaryFiles_VCL/BinaryFiles.res -------------------------------------------------------------------------------- /18/BinaryFiles_VCL/BinaryFiles_MainForm.dfm: -------------------------------------------------------------------------------- 1 | object FormBinary: TFormBinary 2 | Left = 0 3 | Top = 0 4 | Caption = 'BinaryFiles' 5 | ClientHeight = 390 6 | ClientWidth = 663 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | PixelsPerInch = 96 16 | TextHeight = 13 17 | object btnWrite: TButton 18 | Left = 16 19 | Top = 24 20 | Width = 201 21 | Height = 25 22 | Caption = 'Write Binary' 23 | TabOrder = 0 24 | OnClick = btnWriteClick 25 | end 26 | object btnRead: TButton 27 | Left = 16 28 | Top = 64 29 | Width = 201 30 | Height = 25 31 | Caption = 'Read Binary' 32 | TabOrder = 1 33 | OnClick = btnReadClick 34 | end 35 | object Memo1: TMemo 36 | Left = 232 37 | Top = 24 38 | Width = 417 39 | Height = 353 40 | TabOrder = 2 41 | end 42 | object btnWriteRecord: TButton 43 | Left = 16 44 | Top = 120 45 | Width = 201 46 | Height = 25 47 | Caption = 'Write Record' 48 | TabOrder = 3 49 | OnClick = btnWriteRecordClick 50 | end 51 | object btnReadRecord: TButton 52 | Left = 16 53 | Top = 159 54 | Width = 201 55 | Height = 25 56 | Caption = 'Read Record' 57 | TabOrder = 4 58 | OnClick = btnReadRecordClick 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /18/IoFilesInFolder_VCL/IoFilesInFolder.dpr: -------------------------------------------------------------------------------- 1 | program IoFilesInFolder; 2 | 3 | uses 4 | Forms, 5 | IoFilesInFolderMainForm in 'IoFilesInFolderMainForm.pas' {FormIoFiles}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormIoFiles, FormIoFiles); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /18/IoFilesInFolder_VCL/IoFilesInFolder.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/18/IoFilesInFolder_VCL/IoFilesInFolder.res -------------------------------------------------------------------------------- /18/ReaderWriter_VCL/ReaderWriter.dpr: -------------------------------------------------------------------------------- 1 | program ReaderWriter; 2 | 3 | uses 4 | Forms, 5 | ReaderWriter_MainForm in 'ReaderWriter_MainForm.pas' {FormReaderWriter}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TFormReaderWriter, FormReaderWriter); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /18/ReaderWriter_VCL/ReaderWriter.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/18/ReaderWriter_VCL/ReaderWriter.res -------------------------------------------------------------------------------- /18/ReaderWriter_VCL/ReaderWriter_MainForm.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/18/ReaderWriter_VCL/ReaderWriter_MainForm.pas -------------------------------------------------------------------------------- /18/ReaderWriter_VCL/test.txt: -------------------------------------------------------------------------------- 1 | Hello, 5 -------------------------------------------------------------------------------- /18/StringBuilderDemo_VCL/StringBuilderDemo.dpr: -------------------------------------------------------------------------------- 1 | program StringBuilderDemo; 2 | 3 | uses 4 | Forms, 5 | StringBuilderDemo_MainForm in 'StringBuilderDemo_MainForm.pas' {Form2}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm2, Form2); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /18/StringBuilderDemo_VCL/StringBuilderDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarcoDelphiBooks/ObjectPascalHandbook/e834b2b93f616564ce66cd6eed7538e5e833b6a1/18/StringBuilderDemo_VCL/StringBuilderDemo.res -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Object Pascal Handbook 2 | Object Pascal Handbook demos source code 3 | 4 | The book content is copyright Marco Cantu, www.marcocantu.com 5 | The demo source code copy is copyrighted by Marco, but can be used freely. 6 | --------------------------------------------------------------------------------