powerbuilder 6

15
Using PowerBuilder 6 CJUB lam B. Hayes with Charles A. Wood

Upload: others

Post on 26-Jun-2022

22 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: PowerBuilder 6

Using

PowerBuilder 6 CJUB lam B. Hayes with

Charles A. Wood

Page 2: PowerBuilder 6

Table of Contents

Introduction 1

New Features in PowerBuilder 6 2

Who Should Use This Book? 2

How Is This Book Different from the Last Edition? 4

How to Use This Book 4

I Introducing PowerBuilder

1 Introducing PowerBuilder 9

Describing PowerBuilder's Main Components 10

Using PowerBuilder as an Object-Oriented Environment 11

Using Visual Design 12 Using Iterative Development 12

Installing PowerBuilder 13

Using PowerBuilder Libraries 13 Creating a Library 14 Using Libraries 17

Using the PowerBuilder Application Painter and Applications 17

Selecting Your Application 17

Understanding Property Sheets 20 Viewing the Application Property Sheet 20 Specifying a Library Path 20

Using Menu Options in PowerBuilder Painters 22

Saving Your Work 22 Closing the Painters 22 Exiting PowerBuilder 23 Using Control Menu Boxes 23

Using Menus 24 Making Your Menu 25 Saving Your Menu 28

Using Windows 28 Saving Your Window 29 Associating a Menu to Your Window 32 Comparing SDI versus MDI Frame 33 Using MicroHelp 33

Coding Your Application with PowerScript and Events 36

Exploring PowerBuilder Events 36 Programming in PowerScript 37

Using the Database Interface 42

Using DataWindows 42

Using Online Help 43

Customizing Your PowerBuilder Toolbars 43

Using the Toolbars Dialog Box 43 Positioning Toolbars 44 Showing Text 45 Showing PowerTips 45 Adding, Deleting, and Rearranging Icons 45

Running Your PowerBuilder Application 46

2 Understanding Analysis, Design, and Databases 47

Understanding the Systems Development Life Cycle 48

Understanding the User's Requirements 48

Exploring Analysis 49 Conceptual Data Modeling 50

Building the Logical Data Model 53 Assign Attributes to Entities 53 Relational and Data Modeling Terminology 55 Normalization 57 Refining Cardinality 61

Page 3: PowerBuilder 6

Special Edition Using PowerBuilder 6

Implementing a Data Model with the PowerBuilder Database Painter 64

Creating a Database 64 Connecting and Customizing Your Database 66 Creating Tables 68 Creating the Inventory Tracking System 74 Viewing Tables in the Database Painter 74 Modifying Tables 76 Right-Clicking in the Database Painter 78 Using the Table Painter Icon 81 Adding Foreign Keys 82 Manipulating Data in a Table 84 Dropping a Table 89

Exploring PowerBuilder Database Independence 89

Using Views 90

3 Understanding Object-Oriented Concepts 93

Understanding Object-Orientation 94

Understanding Classes, Objects, and Instances 94

Class 94 Objects 94 Object Instances 95 Classes versus Instances 95

Understanding Object Components 95 Properties 95 Services and Operations 96 Methods 96 Functions 96 Events 96 Inheritance 96

Working with Encapsulation 97 What Is Encapsulation? 97 Variable Scope 97 Public, Private, and Protected Access 98 Defining the Public Interface 100

Understanding Polymorphism 102

Understanding Variable Data Types 103

Defining Constants 104

II PowerBuilder Development

4 Using the Application Painter 107

Defining the Application Object 108

Setting Application Properties 108 Libraries 109 Viewing General Properties 109 Using Default Fonts 110 Setting the Application Icon 111 Setting Variable Types 112

5 Using the Library Painter 115

Navigating with the Library Painter 116 Jumping to a Painter 116 Selecting Entries 117 Copying or Moving Library Entries 118 Deleting Library Entries 118

Exporting and Importing Library Entries 119

Printing Library Entries 120

Modifying Properties of a Library or Library Entry 121

Searching Library Entries 122

Understanding Regeneration 123

Rebuilding Your Code 123

Migrating a PowerBuilder Application 124

Manipulating Library Files 125 Printing a Library Directory 125 Optimizing a Library 125 Creating a New Library 126 Deleting a Library 127

Building a Runtime Library 127

Setting Library Options 129

Page 4: PowerBuilder 6

6 Using the Menu Painter 131

Designing Your Menu 132

Developing Your Menu Using the Menu Painter 133

Adding Options 134 Using General Properties 135 Using Shortcut Keys 136 Using Cascading Menus 138 Previewing Your Menu 139

Implementing Toolbars 141 Using Toolbars 141 Making a Toolbar 141

Adding Menu Inheritance 143 Creating Application Specific Menus 143 Implementing Menu Inheritance 144 Inheriting the Sheet Menus 148 Attaching Your Menu to a Window 148 Run Your Application to Show the Toolbar 149

7 Using the Window Painter 151

Using the Window Property Sheet 152 General Window Properties 153

Adding Window Controls 160 New Windows 95 Controls 160 Other Types of Window Controls 171 Tab Order 186

Implementing Advanced Window Features 187

Creating Windows by Using Inheritance 187 Associating a Menu with the Window 188

Opening a Window Sheet 193 Listing Open MDI Sheets 194

III Programming PowerBuilder

8 Using Events, Functions, and PowerScript 199

Contents I ix

Understanding Events 200 Entering the PowerBuilder Script Painter 200 Using the Event List Box 201 Implementing User-Defined Events 202

Discussing the PowerScript Language 203

PowerScript Fundamentals 203 Using Variables 204 Using Operators 217 Using PowerBuilder Commands 221 Using Built-in Functions 230 Using Context-Sensitive Help 230

Using the PowerBuilder Script Painter 230

Using the Undo Function 230 Selecting Text 231 Commenting and Uncommenting 231 Copying, Clearing, and Cutting Text 231 Pasting Text 232 Pasting Statements 232 Pasting Functions 233 Using the Paste List Boxes 233 Using the Object Browser from the Script Painter 234

9 Using PowerScript 237

Understanding Database Transactions 238

Exploring PowerBuilder's Transaction Objects 238 Creating a Transaction Standard Class in the User Object Painter 240

Implementing User-Defined Functions 242

Using the PowerBuilder Global Function Painter 247 Creating a DataWindow Control User Object 248 Associating a DataWindow to Database Connection 250 Inheriting a DataWindow User Object 250

Page 5: PowerBuilder 6

x I Special Edition Using PowerBuilder 6

Using Your Transaction User Object in Your Application 251 Using the Transaction Object to Connect to Your Database 253

Scripting for Specific Events 255 Triggering and Posting Events and Functions 255 Script for Application Events 256 Script for Menu Items 257 Script for Window Events 262 Using Function Arguments 264 Using Event Arguments 266 Script for DataWindow Control Events 267

Scripting for Treeviews 269

Avoiding Trouble 273

10 Using SQL in PowerBuilder 275

Understanding SQL Syntax 276 The SELECT Command 276 The INSERT Command 278 The UPDATE Command 279 The DELETE Command 280 The CONNECT and DISCONNECT Commands 280 The COMMIT and ROLLBACK Commands 281

Using SQL Transactions and Testing Your SQLCode 281

Understanding NULL 282

Using the SQL Painter 283

Using Cursors 284 The DECLARE Command 285 The CURSOR Painter 285 The OPEN Command 286 The FETCH Command 286 The CLOSE Command 286 The UPDATE and DELETE Commands (Positioned) 286 Example of a Cursor 287

IV Using DataWindows

11 Creating DataWindows 291

Introduction to DataWindows 292

Using the DataWindow Painter 292

Understanding DataWindow Options 294 Using General Options 294 Using Zoom Options 294 Using Generation Options 294

Understanding Data Sources 296 Quick Select 296 SQL Select 297

Determining Presentation Style 297

Creating Freeform DataWindows Using Quick Select 299

Making the Item DataWindow 300 Making the Customer DataWindow 306 Making the Warehouse and Supplier DataWindows 307

Reviewing Invoice Design 308 Making djnvoicejieader and djnvoicejboter DataWindows 309 Making the djnvoicejdetail DataWindow by Using a SQL Select/ Tabular DataWindow 311

Using Other Data Sources 317 Queries 318 External Data Sources 319 Stored Procedures 320

Using DataWindow Control User Objects 320

Associating DataWindow Controls with a DataWindow Object 321

Running Your Application 325

Page 6: PowerBuilder 6

12 Enhancing DataWindows 327

Using Edit Styles 328 Edit Style 328 Drop-Down List Box Edit Style 330 Radio Button 333 Checkbox Edit Style 334 EditMasks 336 Using Drop-down DataWindows 338

Using Display Formats 342

Using Validation Rules 343

Using the Database Painter to Define Display Formats, Edit Styles, and Validation Rules 345

Defining Your Own Edit Styles 345 Defining Your Own Display Formats 347 Defining Your Own Validation Rules 348 Setting Different Column Defaults 349

Using Conditional Expressions 352

13 Manipulating Data Using DataWindows 355

Filtering 356

Sorting 357

Modifying Your Data Source 358 Customizing Your Data Source Viewing Area 358 Changing Your Data Source 361 Using the DISTINCT Statement 364 Using the SQL Select Painter 365

Retrieving Data into a DataWindow 371

Inserting Rows into a DataWindow 372

Deleting Rows from Your DataWindow 372

Updating Your Database with Your DataWindow 373

Confirming Actions Before Losing Data 373

Contents I xi

Using a Drop-Down DataWindow for Retrieval 374 Retrieving Data Inside a Drop-Down DataWindow 378

Accessing DataWindow Columns 380 Setting Column Information from a DataWindow 381 Retrieving Column Information from a DataWindow 382 Changing DataWindow Properties 383

14 Creating Reports 385

Understanding PowerBuilder Reports 386 Similarities Between Reports and DataWindows 386 Differences Between Reports and DataWindows 386

Using the Report Painter 386 Adding the Report Painter Buttons to the Toolbar 386 Launching the Report Painter in Run Mode 387 Launching the Report Painter in Edit Mode 389

Creating a Grouped Report 389 Understanding the Bands of a Group Report 393 Working with Grand Totals and Subtotals 396 Modifying Computed Fields 397 Adding Another Group 402 Setting the Sort Order 404 Suppressing Duplicated Informa­tion 405

Creating Graphs 406 Modifying a Graph 409 Selecting a Different Kind of Graph 411

Creating Label Reports 412 Making Adjustments 414 Sliding a Column 416

Creating Nested Reports 417

Using Crosstabs 419

Page 7: PowerBuilder 6

xii I Special Edition Using PowerBuilder 6

V Delivering the Final Product

15 Finalizing Your Application 425

Adding Help for Inventory Tracking 426

Adding an About Window 426

Adding to Inheritance 429 Handling Ancestor Events from the Child Event 429 Updating a Multiple-Table DataWindow 431

Adapting the Invoice Tab on the wjnvoice Window 432

Adding Script for dwjnvoicejieader 432 Adding Script for dwjnvoicejboter 434 Adding Script for dw_invoice_detail 435

Adding the Inventory Report 437 Creating the Report 437 Creating a Hidden DataWindow 438 Using DataStores 441

Last-Minute Cleanup of Your System 442

Running Through the Inventory Tracking System 443

16 Debugging Your Applications 447

Introducing the PowerBuilder 6 Debugger 448

The New Debug Window 448 Panes 449 Debug Views 450

Using Breakpoints 453 Occurrence Breakpoints 453 Conditional Breakpoints 454 Variable Breakpoints 454

Layout Management in the Debug Window 454

Displaying Title Bars in a Pane 454 Rearranging Panes 455 Rearranging Tabbed Panes 456

Resizing Panes 456 Adding and Removing Panes 456 Combining Variable Views 456 Layout Preferences 457 View Icons 458

Understanding the Source Views 458 Using the Source Browser View 458 Using the Source History View 459 Using the Source View 460

Using and Setting Breakpoints 462 Setting Unconditional Breakpoints 463 Setting Occasional, Conditional, and Variable Breakpoints 463 Disabling and Clearing Breakpoints 465

Examining the State of an Application 466 Using Variable Views 466 Examining Objects in Memory 467 Using the Call Stack 468 Modifying the Value of a Variable 470

Stepping Through an Application 470 Continuing to Next Breakpoint 470 Single Stepping (Step In and Step Over) 470 Stepping Out of a Function (Step Out) 471 Run to Cursor 471 Set Next Statement 472

Terminating the Debugging Session 473

Just-in-Time Debugging 473 Breaking into the Debugger at Execution Time 474 System Errors 475 Launching the Debugger from Script 475

17 Building the Executable in the Project Painter 477

Preparing to Build the Executable 478

Using PowerBuilder Runtime Libraries (PBDs and DLLs) 478

Stub Executable Files (EXE) 479 Machine Code Dynamic Libraries (DLLs) 479

Page 8: PowerBuilder 6

Contents XIII

Pcode Dynamic Libraries (PBDs) 479 Creating Dynamic Runtime Libraries 479

Using Project Definitions 480 Project Build Options 483 Code Generation Options 483 Dynamic Library Options 484 PBD 484

Using Resources and PowerBuilder Resource Files (PBRs) 484

Building a PowerBuilder Resource File (PBR) 485 Adding Dynamic DataWindow Objects 485

PowerBuilder Virtual Machine 485

Machine Code versus Pcode Considerations 486

When Machine Code Improves Performance 487 When Machine Code Has No Affect on Performance 487 Performance Tips 487

Using the Correct Version of PowerBuilder to Create Deployment Files 488

Script Size Limitations 489 Variable Scope 489 Path Names for External Files 489

Debugging at Runtime 490

VI User Objects

18 Understanding User Objects 493

Creating Visual User Objects 494 Standard Visual User Objects 494 Custom Visual User Objects 500 Adding Visual User Objects to a Window 503

Creating Classes (Nonvisual User Objects) 503

Standard Classes 503 Custom Classes (Nonvisual User Objects) 509

Managing Your Objects 512 Custom Class Example: An Object Manager 516

Constructing Business Objects 517 Business Objects and DataWindows 518 Mapping Business Objects to Relational Databases 519

Golden Rules for Object-Oriented PowerBuilder Development 521

19 Using the C++ Class Builder 523

C++ and PowerBuilder 524

Installing Watcom C++ for User Objects 524

Defining a C++ Object 525

Using the Watcom IDE Environment 528

Accessing Your C++ User Object Function 532

Defining C++ Class Variables from PowerBuilder 532

Final Thoughts on C++ 533

20 Using PowerBuilder with OLE 2.0 535

Introducing OLE 536 OLE Compound Documents 537 COM: The Component Object Model 538 Competing Component Architectures 539

Using OLE Controls in PowerBuilder 539 OLE Object 539 Adding an OLE Control to a Window 539

Adding OCX and ActiveX Controls to Your Application 545

Registering a New OLE OCX Control to Windows 546 Placing an OCX Control on a Window 547

Page 9: PowerBuilder 6

xiv I Special Edition Using PowerBuilder 6

Viewing the Properties of OLE Objects 547 Adding Script to an OLE Custom Control 551

Using Outbound OLE Automation 552 Using PowerBuilder as an OLE Automation Server 554 Using a DataStore User Object as an OLE Automation Server 556 Creating Registry Information for OLE Automation Objects 560

Using the OLE Data Window Presentation Style 564

Uniform Data Transfer 564 Creating an OLE Data Window 565

VII Distributed Computing

21 Distributed PowerBuilder 571

Using Distributed PowerBuilder 572

Introduction to Distributed PowerBuilder 572

Developing with Distributed PowerBuilder 574 Implementing with Distributed PowerBuilder 576 Designing the DPB Server Interface 576 The Listen () Function 577 Creating the DPB Client Application 579 Local/Remote Location Transparency 583 Implementing Distributed PowerBuilder Applications 590 Creating the Proxies for the Remote Objects 590 Creating the Client and Server Executables 593

Additional Distributed PowerBuilder Features 594

Asynchronous Processing 594 Shared Objects 595

Using Server Push 596 Using the Distributed Name Server 597

22 Cross-Platform Development and Deployment 599

Understanding PowerBuilder's Cross-Platform Support 600

Writing PowerBuilder Applications for Multiple Platforms 600

Avoid Windows Proprietary Technologies 600 Using the PowerBuilder Environment Object 601 Accessing the Windows API 602 Font Mapping 604 PowerBuilder Units (PBUs) 605 Build Number on DLLs 606

PowerBuilder VM's Unique DLL Names for Different Platforms 606

Using the PowerBuilder Synchronization Tool (PBSync) 606

Working with File Name and Path Name Differences 607

23 Internet Programming with PowerBuilder 609

Understanding the Internet 610 Standard Internet Communication Protocols 610 Connecting to the Internet 610 Domain Names 610 The World Wide Web (WWW) 611 Uniform Resource Locators (URLs) 612 Hypertext Transfer Protocol (HTTP) 612 Applets 612 Multipurpose Internet Mail Extension (MIME) 612 Plug-ins 612 ActiveX Controls 613 Internet Security 613

Page 10: PowerBuilder 6

Introducing PowerBuilder Internet Developers Toolkit (IDT) 614

DataWindow Plug-In 614 Window Plug-In 614 Window ActiveX 614

Using O'Reilly's WebSite Web Server 615 Installing and Configuring the Web Server 615 Mapping Your Web Server Document Directory to Your Hard Drive 615 Registering MIME Content Types to the Web Server 616 Mapping CGI Directories to the Web Server 617

Using the DataWindow Plug-In 618 Installing the DataWindow and Window Plug-Ins 618 Saving a DataWindow as a Powersoft Report 621 Deploying the Powersoft Report Files on the Web Server 623 Displaying a Powersoft Report in a Web Page 623 Viewing a PSR in the Web Browser 624 Using the Pop-Up Menu 625

Using the Window Plug-In 626 Secure Mode for Plug-Ins and ActiveX 626 Child Window Considerations 627 Deploying the Child Window 627 Embedding a PBD in a Web Page 627 Deploying and Accessing the PowerBuilder Dynamic Libraries (PBDs) on the Web Server 628

Using the PowerBuilder Window ActiveX 628

How the PowerBuilder Window ActiveX Works 630 ActiveX Security 630 ActiveX Client Requirements 630 Deploying the Powersoft Dynamic Libraries (PBDs) on the Webserver 631 Developing and Deploying a Window ActiveX Application 631

Contents I xv

The Role of the Application Object 631 Embedding the Window ActiveX in a Web Page 631

Building a Web Application with Web.PB 632

Distributed PowerBuilder Server Applications 632 Windows TCP/IP Services File 633 Web.PB Preferences File 633 Invoking Distributed PowerBuilder from a Web Browser 634 Defining a Remote Object Function for Creating a Dynamic HTML Page 635 Improved DataWindow HTML Generation 641

Generating Dynamic HTML with the Web.PB Class Library 642

ujitmljvrm 644 ujitmljbrmat 644 u_html_template 644 Generating HTML Forms with the Web.PB Wizard 644 Customizable Web Jumps from PowerBuilder Development Environment Menus 644

VIII Advanced PowerBuilder Development

24 PowerBuilder Foundation Classes 647

Understanding PowerBuilder Foundation Classes (PFC) 648

Introduction to Service-Based Architecture 648

Examining the PFC DataWindow Row Selection Service 649

Introducing PFC Application Services 652 PFC Application Manager 652 Application Debugging Service 654 Application DataWindow Caching Service 654 Error Service 654

Page 11: PowerBuilder 6

xvi I Special Edition Using PowerBuilder 6

Transaction Registration Service 655 Security Service 655 Application Preference Service 655 Most Recently Used Window Service 655

Understanding PFC Menus 655 PFC Menu Inheritance 656 PFC Message Router 656

Understanding PFC Window Services 657

Basic Window Services 657 Window Preference Service 657 Window Sheet Management Service 658 Window Status Bar Service 658 Window Resize Service 658

Understanding PFC DataWindow Services 658

DataWindow Drop-Down Search Service 659 DataWindow Filter Service 659 DataWindow Find and Replace Service 659 DataWindow Linkage Service 659 DataWindow Multi-Table Update Service 659 DataWindow Print Preview Service 659 DataWindow Query Mode Service 660 DataWindow Reporting Service 660 DataWindow Required Column Service 660 DataWindow Row Management Service 660 DataWindow Row Selection Service 661 DataWindow Sort Service 661 DataWindow Resize Service 661 DataWindow Drop-Down Service 661 DataWindow Properties Service 661

Other PFC Features in PowerBuilder 6 661

Library Extension Builder Utility 661 Improved Coding Conventions 662 Enhanced PFC Code Examples 662

Understanding the Role of Service-Based Architectures 662

25 Getting Your CPD 663

The Certified PowerBuilder Developer Program 664

Why Does the CPD Program Exist? 664

What to Expect at the Exam Center 665

How to Prepare for the CPD Exams 665

What the Tests Do Not Cover 666 Vendor-Specific, Database-Related Items 666 Application Frameworks or Class Libraries 666

CPD Associate Fundamentals Test 667 Related Client/Server Technology Fundamentals 667 PowerBuilder Painter Fundamentals 668 PowerScript Fundamentals 670

CPD Associate Advanced Concepts Test 673

Related Client/Server Technology Advanced Concepts 673 PowerBuilder Painter Advanced Concepts 674 PowerScript Advanced Concepts 674

CPD Associate Maintenance Test 676

CPD Professional Application Test 676 Test Workstation Environment 676 PowerBuilder Online Help 677 Application Frameworks and Class Libraries 677 Database Access 677 Other Topics Not Covered on the Professional Application Test 677 Enhancing a Given Working Application 677 Using the Test Class Library 677 Application Test Guidelines 678 Test Scoring 678 Professional Application Test Features 678

Page 12: PowerBuilder 6

Contents | xvii

CPD Professional Maintenance Test 680 Related Technology 680 PowerBuilder Painters 680 PowerScript 681

26 Using the Data Pipeline Painter 683

Creating and Using a Data Pipeline in PowerBuilder 684

Using a Data Pipeline in an Application 689

Understanding Data Warehouses 693

27 Implementing Advanced Techniques for More Flexible Applications 695

Using INI Files for Database Connections 696

Using External DLLs 697

Implementing Drag-and-Drop 697

28 Source and Version Control for Team Development 701

PowerBuilder's Version Control Interface 702

Introducing ObjectCycle 2.0 702

Managing Version Control with PowerBuilder SCC API 703

Setting Up Version Control Projects with ObjectCycle Manager 704

Defining a New Version Control Project 705 Defining Project Folders 706 Defining a New ObjectCycle User 706

Connecting a PowerBuilder Application to a Version Control Manager 708

Understanding PowerBuilder's SCC API Version Control 709 Configuring the PowerBuilder SCC API and ObjectCycle 709

Connecting to the ObjectCycle Server 710

Registering Library Entries to ObjectCycle 712 Check Out a Library Entry to Make Changes 713 Opening Read-Only Versions of Registered Objects 715 Checking In an Entry 716 Listing the Status of an Entry 718 Clearing the Check-Out Status 719 Displaying the ObjectCycle Registration Directory 719 Displaying the ObjectCycle Registration Report 720 Displaying the ObjectCycle Differences Report 720

Managing Version Control Projects with ObjectCycle Manager 721

Get the Latest Version of an Object to File 721 Checkout Report 721 What's New Report 723 Statistics Report 723 Check Out an Object 724 Check In an Object 724 Set Lock 724 Clear Lock 724 Label 724 Synchronize 724 Diff 724 Destroy 724 Rename 725 Properties 725 Dump 725 Load 725 Print 725 Cut 725 Copy 725 Paste 725 Freeze 726 Undo Freeze 726

Page 13: PowerBuilder 6

XVIII iii J Special Edition Using PowerBuilder 6

29 Internationalization of PowerBuilder Applications 727

Introduction to Multi-Lingual Applications 728

Translating Applications with the Translation Toolkit 728

Deploying a Translated Application 729

Creating International Characters with Unicode Support 730

Using Japanese Double-byte Character Support (DBCS) for Kanji 730

Using Arabic and Hebrew Right-to-Left Support (32-bit Only) 731

Arabic and Hebrew PowerScript Functions 731 New Arabic and Hebrew Functions 731 Edit and Format Mask Changes for Hebrew and Arabic 732 INI File Requirements 732

Dealing with Date and Currency Issues 732

Decimal Separators 732 Currency Symbols 732 Units of Measure 732 Dates 732

IX Techniques From the Pros

30 DataWindow Modification Using Modify and Describe 735

Introducing the DataWindow Modify and Describe Functions 736

Changing a DataWindow Dynamically Using Modify 736

Hiding a DataWindow Column at Runtime 737 Updating More Than One Table in a DataWindow 738 Deleting Columns from a DataWindow

at Runtime 740 Adding a Column to a DataWindow at Runtime 740 Changing the SQL Select Statement in a DataWindow 741 Conditionally Changing DataWindow Properties at Runtime 742 Performance Tip for Using Several Modify Statements 742

Accessing DataWindow Properties Using the Describe Function 743

Finding the Display Value of a DropDownDataWindow 743 Displaying Starting and Ending Row Numbers on Each Page 744 Helpful Hints for Modify and Describe 745 Guidelines for Using Quotes and Tildes 745 Using Online Help to find DataWindow Properties 746 Using the DataWindow Syntax Editor 747

31 Using DataWindow ShareData Functions 749

Understanding ShareData Functions 750

Examining Working Examples of ShareData Functions 750

Example #1: Sharing Similar DataWindows 751 Example #2: Using ShareDataOff 752 Example #3: Sharing Drop-Down Child DataWindows 753 Example #4: Sharing DataWindows with Different Appearances 754 Example #5: Sharing Row Settings 755

DataWindow Sharing Considerations 756

32 Advanced Object-Oriented Concepts 757

Functions versus Events 758 Message Timing 758 Information Passing 758

Page 14: PowerBuilder 6

Typing 758 Method Encapsulation 759 Ease of Discovery 759 New PowerBuilder Syntax for Events and Functions 759 Overriding and Extending Methods 762

Object Coupling 763

Defining Message Interfaces 764 Passing Named Arguments 764 Passing Structures 764 Passing Objects 766

Function Overloading 766

Polymorphism 768

Message Binding 769

Object Creation 769

Passing Arguments by Value, Reference, or Read-Only 770

Reference Typing 771 Avoiding Orphans 774

Generating Ancestor Return Values 775

Read and Write Access Rights as Encapsulation Problems 776

X Appendixes

A Using Naming Conventions 781

Introduction to Naming Conventions 782

Window Control Names 782

Standard Class Name Prefixes 783

Class Names 784

Variable and Identifier Names 785 Variable Scope Naming Prefix 785 Standard Data Type Names 785 Variable Name Examples 787

Object Functions and Events 787

Contents I xix

B Using the SQL Anywhere Database and SQL Anywhere 789

Introduction to SQL Anywhere 790

Understanding Sybase SQL Anywhere Files 790

Understanding the Sybase SQL Anywhere DB (Database) File 790 Understanding the Sybase SQL Anywhere LOG (Transaction Log) File 790

Using Sybase SQL Anywhere 791 Understanding Connection Param­eters 791 Using DBENG50.EXE and DBSTART.EXE 793 UsingDBBACKUP.EXE 795 UsingDBCOLLAT.EXE 795 UsingDBERASE.EXE 795 UsingDBEXPAND.EXE 796 UsingDBINFO.EXE 796 UsingDBINIT.EXE 796 UsingDBLOG.EXE 797 Using DBSHRINK.EXE 797 UsingDBTRAN.EXE 797 UsingDBUNLOAD.EXE 797 UsingDBVALID.EXE 798 UsingDBWRITE.EXE 798 Using ISQLEXE and RTSQL.EXE 798 Exploring Embedded SQL and ISQL 799

Comparing the Runtime Version and the Developer's Version 799

Listing Sybase ISQL Commands 799 Using CONFIGURE 799 Using Variables 800 Using INPUT 801 Using OUTPUT 801 Using PARAMETERS 802 Using READ 802 Using SET 802

Page 15: PowerBuilder 6

xx I Special Edition Using PowerBuilder 6

C Developing in Windows 95 and NT 805

Understanding Long File Names in Windows 95 and NT 806

Using the Windows Registry 806

D Getting Help with Your PowerBuilder Applications 809

PowerBuilder Help 810

Getting Help from Powersoft 810 Powersoft FaxLine 811 Team Powersoft 811 World Wide Web (Internet) 811 Internet Newsgroups 811 CompuServe Forums 812 Powersoft Bulletin Board 812 File Transfer (FTP) 812

PowerBuilder Technical Support 812 Technical Support Programs for the Workplace 812 Technical Support Programs for the Enterprise 813 Pay-As-You-Go Technical Support 813 Pricing 813

Finding Powersoft CODE Partners 814

Getting Help from Third-Party Sources 814

Joining PowerBuilder User Groups 814

E What's on the Web Site? 815

Using This Appendix 816

Sample Files 816

PBAPI 817 Understanding the Windows API 817 Using External Functions with Powerscript 818

Index 821