Kylix Developer's Guide 0672320606, 9780672320606, 9780768658484

Delphi for Linux (Kylix) Development includes three main themes. First, the book recognized that much of its audience wi

182 36 6MB

English Pages 638 Year 2001

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Developer’s Guide......Page 1
Contents......Page 3
Tables......Page 17
Figures......Page 18
What’s in this manual?......Page 19
Ordering printed documentation......Page 20
Part I: Programming with Kylix......Page 21
Integrated development environment......Page 23
Developing applications......Page 24
Editing code......Page 25
Debugging applications......Page 26
Deploying applications......Page 27
Understanding CLX......Page 29
Properties......Page 31
System events......Page 32
Examining a Kylix object......Page 33
Changing the name of a component......Page 35
Scope and qualifiers......Page 36
Private, protected, public, and published declarations......Page 37
Using object variables......Page 38
Components and ownership......Page 39
Major branches of the CLX hierarchy......Page 40
TObject branch......Page 41
TComponent branch......Page 42
TControl branch......Page 44
Using components......Page 45
Components on the component palette......Page 46
Text control properties......Page 47
Track bars......Page 48
Buttons and similar controls......Page 49
Check boxes......Page 50
Splitter controls......Page 51
List boxes and check-list boxes......Page 52
List views......Page 53
Panels......Page 54
Header controls......Page 55
Status bars......Page 56
Draw grids......Page 57
Shapes......Page 58
Using open dialog boxes......Page 59
Working with string lists......Page 60
Creating a new string list......Page 61
Manipulating strings in a list......Page 63
Creating drawing spaces......Page 65
Using streams......Page 66
Understanding classes......Page 69
Defining classes......Page 70
Protecting blocks of code......Page 72
Exceptions and the flow of control......Page 73
Nesting exception responses......Page 74
What kind of resources need protection?......Page 75
Handling RTL exceptions......Page 76
What are RTL exceptions?......Page 77
Exception handling statements......Page 78
Using the exception instance......Page 79
Providing default exception handlers......Page 80
Reraising the exception......Page 81
Exception handling with external sources......Page 82
Silent exceptions......Page 83
Raising an exception......Page 84
Interfaces as a language feature......Page 85
Implementing interfaces across the hierarchy......Page 86
Using interfaces with procedures......Page 87
TInterfacedObject......Page 88
Using the as operator......Page 89
Using implements for delegation......Page 90
Using reference counting......Page 91
Working with strings......Page 92
String types......Page 93
Long strings......Page 94
Runtime library string handling routines......Page 95
Commonly used long string routines......Page 96
Declaring and initializing strings......Page 99
String dependencies......Page 100
Passing a local variable as a PChar......Page 101
Strings and characters: related topics......Page 102
Deleting a file......Page 103
Finding a file......Page 104
Changing file attributes......Page 105
File types with file I/O......Page 106
Creating and opening files......Page 107
Reading and writing to files......Page 108
Seeking a file......Page 109
Copying......Page 110
Object Pascal data types......Page 111
GUI applications......Page 113
Console applications......Page 114
Working with shared object libraries......Page 115
Writing database applications......Page 116
Using sockets in applications......Page 117
Using data modules and remote data modules......Page 118
Accessing a data module from a form......Page 119
Adding items to the Object Repository......Page 120
Copying an item......Page 121
Modifying shared items......Page 122
Creating and using component templates......Page 123
Help system interfaces......Page 124
Communicating with the Help Manager......Page 125
Asking the Help Manager for information......Page 126
Displaying tables of contents......Page 127
Implementing IExtendedHelpViewer......Page 128
Registering Help viewers......Page 129
How controls process Help......Page 130
Using IHelpSystem......Page 131
Customizing the IDE Help system......Page 132
Using the main form......Page 133
Linking forms......Page 134
Setting up the look and feel of your application......Page 135
Using forms......Page 136
Creating forms dynamically......Page 137
Using a local variable to create a form instance......Page 138
Passing additional arguments to forms......Page 139
Retrieving data from modeless forms......Page 140
Retrieving data from modal forms......Page 141
Creating frames......Page 143
Using and modifying frames......Page 144
Using action lists......Page 145
Setting up action lists......Page 146
Responding with events......Page 147
Updating actions......Page 149
Writing action components......Page 150
Creating and managing menus......Page 151
Designing menus......Page 152
Naming the menu items......Page 154
Adding, inserting, and deleting menu items......Page 155
Creating submenus......Page 156
Viewing the menu......Page 158
Commands on the context menu......Page 159
Switching between menus at design time......Page 160
Using menu templates......Page 161
Saving a menu as a template......Page 162
Designing toolbars......Page 163
Adding a speed button to a panel......Page 164
Creating a group of speed buttons......Page 165
Adding a tool button......Page 166
Creating groups of tool buttons......Page 167
Adding hidden toolbars......Page 168
Hiding and showing toolbars......Page 169
Setting text alignment......Page 171
Adding scroll bars at runtime......Page 172
Selecting text......Page 173
Cutting, copying, and pasting text......Page 174
Providing a pop-up menu......Page 175
Handling the OnPopup event......Page 176
Indicating that a control is owner-drawn......Page 177
Sizing owner-draw items......Page 178
Drawing owner-draw items......Page 179
Overview of graphics programming......Page 181
Types of graphic objects......Page 182
Common properties and methods of Canvas......Page 183
Using pens......Page 185
Changing the brush color......Page 187
Setting the Brush Bitmap property......Page 188
Drawing lines and polylines......Page 189
Drawing shapes......Page 190
Keeping track of which drawing tool to use......Page 191
Changing the tool with speed buttons......Page 192
Drawing shapes......Page 193
Sharing code among event handlers......Page 194
Placing the control......Page 196
Drawing on the bitmap......Page 197
Loading a picture from a file......Page 198
Replacing the picture......Page 199
Using the clipboard with graphics......Page 200
Pasting graphics from the clipboard......Page 201
Responding to the mouse......Page 202
Responding to a mouse-down action......Page 203
Responding to a mouse move......Page 204
Adding a field to a form object to track mouse actions......Page 205
Tracking the origin point......Page 206
Tracking movement......Page 207
Defining thread objects......Page 209
Assigning a default priority......Page 210
Using the main CLX thread......Page 211
Handling exceptions in the thread function......Page 213
Locking objects......Page 214
Using the multi-read exclusive-write synchronizer......Page 215
Waiting for a thread to finish executing......Page 216
Waiting for a task to be completed......Page 217
Overriding the default priority......Page 218
Debugging multi-threaded applications......Page 219
Porting Windows applications to Linux......Page 221
Porting your application......Page 222
CLX versus VCL......Page 224
Variants......Page 225
Missing in CLX......Page 226
Features that will not port......Page 227
Kylix and Delphi unit comparison......Page 228
Differences in CLX object constructors......Page 231
Environmental differences between Windows and Linux......Page 232
Directory structure on Linux......Page 234
Writing portable code......Page 235
Using conditional directives......Page 236
Terminating conditional directives......Page 237
Including inline assembler code......Page 238
Messages and system events......Page 239
Programming differences on Linux......Page 240
dbExpress differences......Page 241
Component-level differences......Page 242
Porting database applications to Linux......Page 243
Updating data in dbExpress applications......Page 245
Porting Internet applications to Linux......Page 247
Ch 11: Working with packages and components......Page 249
Runtime packages......Page 250
Using packages in an application......Page 251
Design-time packages......Page 252
Installing component packages......Page 253
Creating a package......Page 254
Editing package source files manually......Page 255
The Requires clause......Page 256
Compiling packages......Page 257
Package-specific compiler directives......Page 258
Package files created by a successful compilation......Page 259
Distributing packages to other developers......Page 260
Localization......Page 261
Multiple byte character sets......Page 262
Wide characters......Page 263
Formats and sort order......Page 264
Creating resource modules......Page 265
Localizing applications......Page 266
Deploying general applications......Page 269
Package files......Page 270
Deploying database applications......Page 271
Deploying Web applications......Page 272
Programming for varying host environments......Page 273
Considerations when dynamically resizing forms and controls......Page 274
Accommodating varying color depths......Page 275
README......Page 276
Third-party product documentation......Page 277
Part II: Developing database applications......Page 279
Using databases......Page 281
Types of databases......Page 282
Transactions......Page 283
General structure......Page 284
The data module......Page 285
Using a client dataset with data stored on disk......Page 286
Using a unidirectional dataset directly......Page 288
Using a client dataset to buffer records......Page 289
Using a multi-tiered architecture......Page 291
Combining approaches......Page 292
Ch 15: Using data controls......Page 295
Using common data control features......Page 296
Changing the associated dataset at runtime......Page 297
Editing and updating data......Page 298
Editing data in a control......Page 299
Refreshing data display......Page 300
Displaying data as labels......Page 301
Displaying and editing text in a memo control......Page 302
Displaying and editing data in list and combo boxes......Page 303
Restricting field values with radio controls......Page 306
Displaying multiple records......Page 307
Viewing and editing data with TDBGrid......Page 308
Creating a customized grid......Page 309
Creating persistent columns......Page 310
Deleting persistent columns......Page 311
Setting column properties at design time......Page 312
Defining a lookup list column......Page 313
Restoring default values to a column......Page 314
Displaying composite fields......Page 315
Setting grid options......Page 316
Controlling grid drawing......Page 317
Responding to user actions at runtime......Page 318
Navigating and manipulating records......Page 319
Hiding and showing navigator buttons at runtime......Page 320
Using a single navigator for multiple datasets......Page 321
Ch 16: Understanding datasets......Page 323
Opening and closing datasets......Page 324
Determining and setting dataset states......Page 325
Inactivating a dataset......Page 326
Browsing a dataset......Page 327
Enabling dataset editing......Page 328
Enabling index-based operations......Page 329
Navigating datasets......Page 330
Using the First and Last methods......Page 331
Using the Eof and Bof properties......Page 332
Bof......Page 333
Marking and returning to records......Page 334
Using Locate......Page 336
Displaying and editing a subset of data using filters......Page 337
Creating filters......Page 338
Setting filter options......Page 341
Modifying data......Page 342
Editing records......Page 343
Inserting records......Page 344
Posting data to the database......Page 345
Modifying entire records......Page 346
Using dataset events......Page 347
Using OnCalcFields......Page 348
Ch 17: Working with field components......Page 349
Dynamic field components......Page 350
Persistent field components......Page 351
Creating persistent fields......Page 352
Defining new persistent fields......Page 353
Defining a data field......Page 354
Defining a calculated field......Page 355
Defining a lookup field......Page 356
Setting persistent field properties and events......Page 358
Setting display and edit properties at design time......Page 359
Controlling and masking user input......Page 360
Handling events......Page 361
Working with field component methods at runtime......Page 362
Displaying field component values in standard controls......Page 363
Converting field values......Page 364
Accessing field values with the default dataset property......Page 365
Accessing field values with a dataset’s FieldByName method......Page 366
Specifying constraints......Page 367
Using object fields......Page 368
Working with ADT fields......Page 369
Using the ADT field’s FieldValues property......Page 370
Using the array field’s FieldValues property......Page 371
Accessing data in a nested dataset......Page 372
Accessing data in a reference field......Page 373
Ch 18: Using unidirectional datasets......Page 375
Connecting to the Server......Page 376
Representing the results of a query......Page 377
Using parameters in queries......Page 378
Representing a table using TSQLTable......Page 380
Working with stored procedure parameters......Page 381
Fetching the data......Page 383
Fetching multiple datasets......Page 384
Specifying the command to execute......Page 385
Creating and modifying server metadata......Page 386
Setting up master/detail relationships with TSQLDataSet or TSQLQuery......Page 387
Setting up master/detail relationships with TSQLTable......Page 388
Accessing schema information......Page 389
The structure of metadata datasets......Page 390
Information about stored procedures......Page 391
Information about fields......Page 392
Information about stored procedure parameters......Page 393
Ch 19: Connecting to databases......Page 395
Specifying connection parameters......Page 396
Using the Connection Editor......Page 397
Opening a connection......Page 398
Controlling server login......Page 399
Starting a transaction......Page 401
Ending a successful transaction......Page 402
Specifying the transaction isolation level......Page 403
Accessing server metadata......Page 404
Iterating through the associated datasets......Page 405
Sending commands to the server......Page 406
Using TSQLMonitor to monitor SQL commands......Page 407
Using a callback to monitor SQL commands......Page 408
Ch 20: Using client datasets......Page 409
Navigating data in client datasets......Page 410
Specifying the index to use for searching......Page 411
Executing a search with Find methods......Page 412
Limiting what records appear......Page 413
Specifying ranges......Page 414
Applying or canceling a range......Page 417
Making the client dataset a detail of another dataset......Page 418
Using nested detail tables......Page 420
Constraining data values......Page 421
Editing data......Page 422
Saving changes......Page 423
Adding a new index......Page 424
Obtaining information about indexes......Page 425
Using indexes to group data......Page 426
Using internally calculated fields in client datasets......Page 427
Specifying aggregates......Page 428
Aggregating over groups of records......Page 429
Adding application-specific information to the data......Page 430
Assigning data directly......Page 431
Using a client dataset with a provider......Page 432
Specifying a data provider......Page 433
Passing parameters to the source dataset......Page 434
Limiting records with parameters......Page 435
Specifying the command to execute on the server......Page 436
Incremental fetching......Page 437
Updating records......Page 438
Reconciling update errors......Page 439
Communicating with providers using custom events......Page 441
When to use TSQLClientDataSet......Page 442
Setting up an SQL client dataset......Page 443
Configuring the internal provider......Page 444
Creating a new dataset......Page 445
Creating a dataset using field and index definitions......Page 446
Creating a dataset based on an existing table......Page 447
Merging changes into data......Page 448
Saving data to a file or stream......Page 449
Ch 21: Using provider components......Page 451
Communicating with the client dataset......Page 452
Choosing how to apply updates......Page 453
Setting options that influence the data packets......Page 454
Responding to client data requests......Page 456
Responding to client update requests......Page 457
Influencing how updates are applied......Page 458
Applying updates to datasets that do not represent a single table......Page 460
Responding to client-generated events......Page 461
Part III: Writing distributed applications......Page 463
Terminology and standards......Page 465
HTTP request header information......Page 466
Composing client requests......Page 467
Types of Web server applications......Page 468
The Web module......Page 469
The structure of a Web server application......Page 470
Adding actions to the dispatcher......Page 471
Action items......Page 472
Enabling and disabling action items......Page 473
Responding to request messages with action items......Page 474
Properties that contain request header information......Page 475
Properties that identify the purpose of the request......Page 476
Creating HTTP response messages......Page 477
Describing the server application......Page 478
Sending the response......Page 479
HTML templates......Page 480
Converting HTML-transparent tags......Page 481
Chaining page producers together......Page 482
Using dataset page producers......Page 484
Specifying the columns......Page 485
Setting up a query table producer......Page 486
Compiling an Apache application for DSO support......Page 487
Debugging Apache DSO applications......Page 488
Implementing services......Page 489
Types of socket connections......Page 490
Describing sockets......Page 491
Choosing between a host name and an IP address......Page 492
Using client sockets......Page 493
Specifying the port......Page 494
Error events......Page 495
Events with client connections......Page 496
Reading and writing events......Page 497
Blocking connections......Page 498
Part IV: Creating custom components......Page 499
Component Library for Cross Platform (CLX)......Page 501
How to create components?......Page 502
Modifying existing controls......Page 503
Subclassing controls......Page 504
Removing dependencies......Page 505
Methods......Page 506
Registration......Page 507
Using the Component wizard......Page 508
Deriving the component......Page 510
Registering the component......Page 511
Testing uninstalled components......Page 512
Testing installed components......Page 513
Defining new classes......Page 515
To add new capabilities to a class......Page 516
Ancestors, descendants, and class hierarchies......Page 517
Hiding implementation details......Page 518
Defining the component writer’s interface......Page 519
Defining the design-time interface......Page 520
Static methods......Page 521
Overriding methods......Page 522
Classes and pointers......Page 523
Why create properties?......Page 525
Types of properties......Page 526
The property declaration......Page 527
Direct access......Page 528
Access methods......Page 529
The write method......Page 530
Specifying no default value......Page 531
Creating array properties......Page 532
Creating properties for subcomponents......Page 533
Creating properties for interfaces......Page 534
Specifying default values......Page 535
Determining what to store......Page 536
Creating methods to store and load property values......Page 537
Overriding the DefineProperties method......Page 538
What are events?......Page 539
Events are properties......Page 540
Event-handler types are procedures......Page 541
Standard events for all controls......Page 542
Changing the standard event handling......Page 543
Triggering the event......Page 544
Event-specific handlers......Page 545
Calling the event......Page 546
Avoiding dependencies......Page 549
Protecting methods......Page 550
Abstract methods......Page 551
Declaring methods......Page 552
Using the canvas......Page 553
Using a picture, graphic, or canvas......Page 554
Off-screen bitmaps......Page 555
Copying bitmapped images......Page 556
Responding to changes......Page 557
Registering components......Page 559
Specifying the components......Page 560
Adding palette bitmaps......Page 561
Deriving a property-editor class......Page 562
Editing the property as text......Page 563
Setting the property value......Page 564
Editing the property as a whole......Page 565
Specifying editor attributes......Page 566
Registering the property editor......Page 567
Registering one property at a time......Page 568
Registering multiple properties at once......Page 569
Using the IsPropertyInCategory function......Page 570
Adding items to the context menu......Page 571
Implementing commands......Page 572
Adding clipboard formats......Page 573
Compiling components into packages......Page 574
Creating and registering the component......Page 575
Overriding the constructor......Page 576
Specifying the new default property value......Page 577
Creating and registering the component......Page 579
Publishing inherited properties......Page 580
Declaring the property type......Page 581
Changing default property values......Page 582
Declaring the class fields......Page 583
Initializing owned classes......Page 584
Setting owned classes’ properties......Page 585
Drawing the component image......Page 586
Refining the shape drawing......Page 587
Creating and registering the component......Page 589
Publishing inherited properties......Page 590
Changing initial values......Page 591
Filling in the cells......Page 592
Storing the internal date......Page 593
Accessing the day, month, and year......Page 594
Generating the day numbers......Page 595
Navigating months and years......Page 597
Moving the selection......Page 598
Providing an OnChange event......Page 599
Excluding blank cells......Page 600
Creating a data-browsing control......Page 601
Adding the ReadOnly property......Page 602
Allowing needed updates......Page 603
Declaring the class field......Page 604
An example of declaring access properties......Page 605
Responding to data changes......Page 606
Creating a data-editing control......Page 607
Responding to mouse-down events......Page 608
Responding to key-down events......Page 609
Modifying the Change method......Page 610
Updating the dataset......Page 611
Index......Page 613

Kylix Developer's Guide 
 0672320606, 9780672320606, 9780768658484

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers