Developer’s Guide Borland® Kylix™ Delphi™ for Linux® Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 Refer to the file DEPLOY located in the root directory of your Kylix product for a complete list of files that you can distribute in accordance with the Kylix License Statement and Limited Warranty. Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. COPYRIGHT © 1983, 2001 Borland Software Corporation. All rights reserved. All Inprise and Borland brand and product names are trademarks or registered trademarks of Borland Software Corporation. Other brand and product names are trademarks or registered trademarks of their respective holders. PrintedintheU.S.A. HDB7010WW21001 1E0R0201 0102030405-9 8 7654321 PDF Contents Chapter 1 TWidgetControlbranch............3-17 Introduction 1-1 Usingcomponents................3-17 Components on the component palette. 3-18 What’sinthismanual?..............1-1 Textcontrols..................3-19 Manualconventions................ 1-2 Textcontrolproperties...........3-19 Developersupportservices............ 1-2 Propertiesofmemocontrols.......3-20 Orderingprinteddocumentation........ 1-2 Specializedinputcontrols..........3-20 Part I Scrollbars..................3-20 Trackbars..................3-20 Programming with Kylix Spin edit controls .............3-21 Buttonsandsimilarcontrols.........3-21 Chapter 2 Buttoncontrols...............3-22 Developing applications with Kylix 2-1 Bitmapbuttons...............3-22 Integrateddevelopmentenvironment......2-1 Speedbuttons...............3-22 Designingapplications..............2-2 Checkboxes................3-22 Developingapplications............. 2-2 Radiobuttons...............3-23 Creatingprojects................ 2-3 Toolbars...................3-23 Editing code. ................ 2-3 Splittercontrols................3-23 Compiling applications . .......... 2-4 Handlinglists.................3-24 Debuggingapplications............ 2-4 Listboxesandcheck-listboxes......3-24 Deployingapplications............ 2-5 Comboboxes................3-25 Treeviews..................3-25 Chapter 3 Listviews..................3-25 Using CLX 3-1 Groupingcomponents............3-26 UnderstandingCLX................ 3-1 Groupboxesandradiogroups......3-26 Properties,methods,andevents.......3-3 Panels....................3-26 Properties.................. 3-3 Scrollboxes.................3-27 Methods...................3-4 Tabcontrols.................3-27 Events....................3-4 Pagecontrols................3-27 Widgetevents................ 3-4 Headercontrols..............3-27 Systemevents................ 3-4 Providingvisualfeedback..........3-28 Whatisanobject?............... 3-5 Labels....................3-28 ExaminingaKylixobject.......... 3-5 Statusbars.................3-28 Changing the name of a component . 3-7 Progressbars................3-29 Inheriting data and code from an object . 3-8 Helpandhintproperties.........3-29 Scopeandqualifiers.............. 3-8 Grids......................3-29 Private, protected, public, and published Drawgrids.................3-29 declarations.................. 3-9 Stringgrids.................3-30 Usingobjectvariables.............3-10 Graphicsdisplay................3-30 Creating, instantiating, and destroying Images....................3-30 objects.....................3-11 Shapes....................3-30 Componentsandownership.........3-11 Bevels....................3-31 MajorbranchesoftheCLXhierarchy......3-12 Paintboxes.................3-31 TObjectbranch.................3-13 Dialogboxes..................3-31 TPersistentbranch...............3-14 Usingopendialogboxes.........3-31 TComponentbranch..............3-14 Usinghelperobjects...............3-32 TControlbranch................3-16 Workingwithlists...............3-32 iii Workingwithstringlists...........3-32 Memory management of interface Loadingandsavingstringlists......3-33 objects.....................4-23 Creatinganewstringlist.........3-33 Usingreferencecounting.........4-23 Manipulatingstringsinalist.......3-35 Notusingreferencecounting.......4-24 Associating objects with a string list . .3-37 Workingwithstrings...............4-24 Creatingdrawingspaces...........3-37 Charactertypes................4-25 Printing.....................3-38 Stringtypes..................4-25 Usingstreams..................3-38 Shortstrings................4-26 Longstrings................4-26 Chapter 4 WideString.................4-27 Common programming tasks 4-1 PChartypes.................4-27 Understandingclasses............... 4-1 OpenString.................4-27 Definingclasses.................. 4-2 Runtime library string handling Handlingexceptions................ 4-4 routines....................4-27 Protectingblocksofcode........... 4-4 Widecharacterroutines..........4-28 Respondingtoexceptions......... 4-5 Commonly used long string Exceptionsandtheflowofcontrol.... 4-5 routines..................4-28 Nestingexceptionresponses....... 4-6 Declaringandinitializingstrings......4-31 Protectingresourceallocations........ 4-7 Mixingandconvertingstringtypes.....4-32 What kind of resources need StringtoPCharconversions.........4-32 protection?.................4-7 Stringdependencies............4-32 Creating a resource protection block . 4-8 Returning a PChar local variable. 4-33 HandlingRTLexceptions........... 4-8 Passing a local variable as a PChar . 4-33 WhatareRTLexceptions?......... 4-9 Compilerdirectivesforstrings........4-34 Creatinganexceptionhandler........4-10 Strings and characters: related topics . 4-34 Exceptionhandlingstatements......4-10 Workingwithfiles................4-35 Usingtheexceptioninstance.......4-11 Manipulatingfiles...............4-35 Scopeofexceptionhandlers........4-12 Deletingafile................4-35 Providing default exception Findingafile................4-36 handlers..................4-12 Changingfileattributes..........4-37 Handlingclassesofexceptions......4-13 Renamingafile...............4-38 Reraisingtheexception..........4-13 Filedate-timeroutines..........4-38 Handlingcomponentexceptions.......4-14 FiletypeswithfileI/O............4-38 Exception handling with external Usingfilestreams...............4-39 sources.....................4-14 Creatingandopeningfiles........4-39 Silentexceptions................4-15 Usingthefilehandle...........4-40 Definingyourownexceptions........4-16 Readingandwritingtofiles.......4-40 Declaringanexceptionobjecttype....4-16 Readingandwritingstrings.......4-41 Raisinganexception............4-16 Seekingafile................4-41 Usinginterfaces..................4-17 Filepositionandsize...........4-42 Interfacesasalanguagefeature........4-17 Copying...................4-42 Implementing interfaces across ObjectPascaldatatypes.............4-43 thehierarchy................4-18 Usinginterfaceswithprocedures.....4-19 Chapter 5 ImplementingIInterface............4-20 Building applications and shared objects TInterfacedObject...............4-20 5-1 Usingtheasoperator.............4-21 Creatingapplications................5-1 Reusingcodeanddelegation.........4-22 GUIapplications.................5-1 Usingimplementsfordelegation.....4-22 Userinterfacemodels............5-2 iv Setting IDE, project, and compilation UsingHelpinaCLXApplication........5-18 options...................5-2 How TApplication processes Help . 5-18 Consoleapplications.............. 5-2 HowcontrolsprocessHelp..........5-18 Creatingpackagesandsharedobjectfiles....5-3 CallingtheHelpsystemdirectly.......5-19 Workingwithsharedobjectlibraries.....5-3 UsingIHelpSystem..............5-19 When to use packages and shared CustomizingtheIDEHelpsystem.......5-20 objects..................... 5-4 Writingdatabaseapplications.......... 5-4 Chapter 6 Building distributed applications . ..... 5-5 Developing the application Distributing applications using TCP/IP . 5-5 user interface 6-1 Usingsocketsinapplications.......5-5 Controlling application behavior .........6-1 CreatingWebserverapplications.....5-6 Usingthemainform..............6-1 Using data modules and remote data Addingforms..................6-2 modules...................... 5-6 Linkingforms................6-2 Creatingdatamodules............. 5-7 Hidingthemainform..............6-3 Creating business rules in a data Workingattheapplicationlevel........6-3 module................... 5-7 Setting up the look and feel of your Accessingadatamodulefromaform....5-7 application...................6-3 Programmingtemplates.............. 5-8 Handlingthescreen...............6-4 Sharing code: Using the Object Repository . 5-8 Managinglayout................6-4 Sharingitemswithinaproject........ 5-8 Usingforms.....................6-4 Adding items to the Object Repository . 5-8 Controlling when forms reside in Sharing objects in a team environment . 5-9 memory.....................6-5 Using an Object Repository item in a Displayinganauto-createdform......6-5 project..................... 5-9 Creatingformsdynamically........6-5 Copyinganitem..............5-9 Creating modeless forms such as Inheritinganitem..............5-10 windows..................6-6 Usinganitem................5-10 Using a local variable to create a form Usingprojecttemplates............5-10 instance...................6-6 Modifyingshareditems............5-10 Passing additional arguments to forms . 6-7 Specifying a default project, new form, Retrievingdatafromforms...........6-8 andmainform................5-11 Retrieving data from modeless forms
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages638 Page
-
File Size-