4th Dimension Design Reference Windows®/Mac™OS
4th Dimension® © 1985 - 2003 4D SA / 4D, Inc. All Rights Reserved.
4th Dimension Design Reference For Mac™OS and Windows®
Copyright© 1985 - 2003 4D SA / 4D, Inc. All rights reserved.
The software described in this manual is governed by the grant of license provided in this package. The soft- ware and the manual are copyrighted and may not be reproduced in whole or in part except for the personal licensee’s use and solely in accordance with the contractual terms. This includes copying the electronic media, archiving, or using the software in any manner other than that provided for in the Software license Agreement. 4D, 4D Draw, 4D Write, 4D View, 4D Insider, 4th Dimension®, 4D Server, 4D Compiler, 4D Backup and the 4th Dimension and 4D logos are registered trademarks of 4D SA. Microsoft and Windows are registered trademarks of Microsoft Corporation. Apple, Macintosh, Power Macintosh, Laser Writer, Image Writer, and QuickTime are trademarks or registered trademarks of Apple Computer Inc. Mac2Win Software Copyright © 1990-2003 is a product of Altura Software, Inc. ACROBAT © Copyright 1987-2003, Secret Commercial Adobe Systems Inc. All rights reserved. ACROBAT is a registered trademark of Adobe Systems Inc. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). 4th Dimension includes cryptographic software written by Eric Young ([email protected]) 4th Dimension includes software written by Tim Hudson ([email protected]). Oracle is a registered Trademark of Oracle Corporation, Redwood Shores, California. Oracle Corporation and 4D are independent companies. Use of the Trademark “Oracle” authorized by Oracle Corporation autho- rized to highlight interoperability only. All other referenced trade names are trademarks, registered trademarks, or copyrights of their respective holders.
IMPORTANT LICENSE INFORMATION Use of this software is subject to its license agreement included with the software. Please read the License Agreement carefully before using the software.
Contents
Preface ...... 17 About the Manuals ...... 18 About This Manual ...... 19 Cross-Platform...... 19 Chapter Descriptions ...... 19 Conventions...... 21
Chapter 1 4th Dimension Basics ...... 23 Starting 4th Dimension ...... 24 Creating a New Database ...... 24 Opening an Existing Database ...... 29 4th Dimension Desktop Files ...... 32 Selecting a different data file ...... 35 Linking a Data File to a Structure File...... 36 Making Backups ...... 36 The Environments ...... 37 The Design Environment ...... 37 The User Environment ...... 39 The Custom Menus Environment ...... 40 Design Environment Editors ...... 41 The Structure Editor ...... 42 The Form Editor ...... 43 The Method Editor ...... 44 The Menu Bar Editor ...... 45 The Password Access Editor ...... 46 The List Editor ...... 47 Picture Library ...... 48 Compiler and application builder...... 50 Compiler...... 50 Application builder ...... 51 Web Services Wizard...... 52
4th Dimension Design Reference 3
Contents
The Design Environment Interface ...... 53 The Design Environment Menus ...... 53 Contextual menus ...... 60 Basics for Using Editor Windows ...... 60 The Toolbar ...... 62 The Explorer ...... 63 Working with the Explorer ...... 63 Tables Page ...... 67 Forms Page ...... 69 Methods Page ...... 72 Constants Page ...... 76 Commands Page ...... 77 Lists Page ...... 82 Components and Plug-ins Page ...... 83 Using Comments...... 84 Runtime Explorer...... 90 Displaying the Window ...... 90 Watch Page...... 91 Process Page ...... 93 Break and Catch Pages ...... 93 Searching in the Database ...... 94 Find window ...... 94 String Types and Scope of the Search ...... 96 Searching Options ...... 97 Platform Interface ...... 98 Where to set the platform ...... 98 Platform Interface Settings...... 99 4D Server Considerations ...... 105
Chapter 2 Setting Preferences ...... 107 Access to the Preferences ...... 107 Interface Theme ...... 109 Look Page...... 110 Formatting Page ...... 113 Style sheet Page ...... 114 Application Theme ...... 114 System Resources Page ...... 115 Client/Server Page ...... 118 Design Mode Theme ...... 120 Fonts Page ...... 120 Method Editor Page ...... 121 Structure Editor Page ...... 125
4 4th Dimension Design Reference
Contents
Options Page ...... 127 Documentation Page ...... 129 Comments Page ...... 131 Database Theme ...... 132 Access Management Page ...... 132 Data Control Page ...... 134 Compilation Theme ...... 137 Setting Page ...... 137 Web Theme ...... 141 Publishing Page ...... 141 Configuration Page ...... 145 4D WebSTAR Page...... 149 Web Services Page ...... 150
Chapter 3 Designing a Database Structure ...... 153 Database Basics ...... 154 Tables ...... 155 Creating a Database Structure ...... 159 Using the Structure Editor ...... 160 Selecting a Table Image ...... 161 Scrolling the Field List...... 161 Resizing a Table Image ...... 162 Moving a Table Image...... 163 Creating a New Table ...... 164 Setting Table Properties ...... 165 Creating Fields and Setting Field Properties...... 172 Creating New Fields ...... 172 Field Types...... 176 Field Attributes ...... 182 Choices and Help ...... 188 Setting the Color of the Field ...... 189 Modifying Fields and Field Properties...... 190 Renaming a Field ...... 191 Changing a Field’s Type ...... 191 Changing a Field’s Attributes ...... 191 Indexing or Reindexing a Field ...... 191 Relating Tables...... 193 Related Fields ...... 195 The One Table and the Many Table...... 197 Setting Relation Properties ...... 200 Related Fields ...... 201 Many to One Properties ...... 201 One to Many Properties ...... 203 Wildcard Choice...... 204
4th Dimension Design Reference 5
Contents
Deletion Control ...... 205 Color ...... 206 Creating a Relation Between Tables ...... 207 Configuring relations ...... 208 Removing Relations ...... 209 Reestablishing Relations ...... 210 Modifying Relation Properties ...... 210 Automatic and Manual Relations ...... 210 Entering Data in Related Tables ...... 211 Using Wildcard Choice Lists ...... 212 Relation Types ...... 214 One to One Relations ...... 214 Many to Many Relations ...... 215 Analyzing Database Relations ...... 220 Circular Relations ...... 221 Multiple Links to the Same Table ...... 222 Relations from Multiple Records...... 223
Chapter 4 Creating Forms ...... 225 About Forms ...... 226 The Form Wizard...... 226 The Form Editor ...... 227 Forms, Tables, and Fields...... 227 Active Objects and Graphic Objects ...... 230 Graphic Objects ...... 231 Object Properties ...... 231 The Form Wizard ...... 232 The Form Editor ...... 234 Creating a New Form...... 235 Selecting Fields for the Form...... 237 Reordering Fields ...... 240 Grouping Fields ...... 241 Removing Fields ...... 242 Using the Form Wizard’s Advanced Options ...... 243 Adding Fields...... 246 Customizing the Appearance of Form Objects ...... 247 Customizing Buttons on the Form ...... 250 Setting the Form Size...... 253 Field Label Placement ...... 254 Form Display Options ...... 254 Adding a Subform to the Form ...... 255 Creating the New Form ...... 257 Setting the Appearance of Form Objects...... 258 Fields and Field Labels ...... 258
6 4th Dimension Design Reference
Contents
Using the Style Sheet Editor ...... 259 Creating a Style Sheet ...... 260 Applying a Style Sheet...... 262 Setting the Current Input and Output Forms ...... 262 Deleting a Form ...... 264 Renaming a Form ...... 264
Chapter 5 Form Editor Basics ...... 267 Using The Form Editor ...... 268 Form Editor Window ...... 268 The Tools Palette ...... 273 Form Editor Menus ...... 277 Displaying and Setting Form and Object Properties . . . . 282 Opening a Form in the Form Editor...... 288 Setting Form Properties ...... 289 Naming the Form ...... 289 Setting Form Access ...... 291 Setting the Platform ...... 292 Choosing a Form Type ...... 293 Setting the Default Window Title ...... 295 Assigning a Menu Bar to a Form ...... 295 Settinizing and Resizing Options ...... 297 Form Events ...... 300 Contextual On-line Help ...... 301 Managing Form Objects ...... 302 Selecting Objects ...... 302 Moving Objects ...... 305 Resizing Objects ...... 307 Using the Rulers ...... 311 Creating Objects...... 312 Grouping Objects ...... 315 Aligning Objects...... 316 Distributing Objects ...... 322 Duplicating Objects ...... 326 Copying Objects on a Form ...... 328 Layering Objects...... 329 Deleting Objects ...... 331 Optimizing the Appearance of Text and Picture Objects . . 332 Scaling a Form ...... 333 Changing the Appearance of Objects ...... 334 Platform Interface and Border Line Style ...... 335 Working with Text Areas ...... 336 Line Widths ...... 341 Fill Patterns ...... 342
4th Dimension Design Reference 7
Contents
Border Patterns ...... 343 Foreground and Background Colors ...... 344 Placing a Picture from the Picture Library ...... 345 Modifying the Background of the Picture ...... 346 Setting the Display Mode for a Static Picture ...... 347 Dissociating a form Picture from its Library Source . . . . 349 Creating a Multi-page Form ...... 350 Adding a Display Page to a Form ...... 350 Moving from Page to Page ...... 352 Deleting a Page ...... 353 Adding Fields to a Blank Page ...... 354 Adding Page Navigation Controls ...... 354 Inherited Forms ...... 355 Using inherited forms ...... 355 Defining an inherited form ...... 356 Data Entry Order ...... 358 Viewing and Changing the Data Entry Order ...... 359 Setting the First Object in the Data Entry Order . . . . . 360 Using a Data Entry Group ...... 361 Restoring the Standard Data Entry Order ...... 361 Viewing and Printing Forms ...... 362 Saving Forms ...... 362
Chapter 6 Working with Fields and Active Objects . . . 365 Active Objects Defined ...... 366 Fields in a form ...... 366 Adding Fields to a Form ...... 367 Modifying a Field in a Form ...... 369 Changing a Field into a Variable and Vice-Versa . . . . . 370 Inserting Dynamic Table and Field Names ...... 370 Data Entry Controls ...... 371 Setting the Enterable and Mandatory Attributes . . . . . 373 Using Choice Lists ...... 374 Using Entry Filters ...... 376 Creating Custom Display Formats and Entry Filters . . . 385 Setting Maximum and Minimum Values ...... 388 Setting Default Values ...... 389 Keyboard layout ...... 392 Adding a Scroll Bar to a Text Object ...... 392 Adding Help to a Field or Object ...... 393 Display Formats ...... 396 Date Field Formats ...... 397 Time Field Formats...... 398 Number Field Formats ...... 399
8 4th Dimension Design Reference
Contents
Alpha Field Formats ...... 404 Boolean Field Formats ...... 405 Picture Field Formats ...... 409 Active Objects on a Form ...... 412 Setting Object Properties ...... 412 Creating an Active Object ...... 414 Display Formats for Objects ...... 415 Data Entry Controls for Enterable Objects ...... 417 Setting the Tabable and Focusable Properties...... 417 Assigning a Keyboard Shortcut ...... 418 Enabling Drag and Drop ...... 419 Types of Active Objects ...... 419 Enterable and Non-enterable Variables ...... 420 Buttons ...... 421 Check Boxes and 3D Check Boxes ...... 426 Radio Buttons, 3D Radio Buttons, and Radio Pictures . . . 427 Picture Buttons ...... 429 Pop-up Menus, Drop-down Lists, and Scrollable Areas . . . 435 Transparent scrolling areas ...... 437 Combo boxes ...... 438 Hierarchical Pop-up Menus and Hierarchical Lists . . . . . 438 Button Grids ...... 439 Picture Pop-up Menus ...... 441 Tab Controls...... 445 Plug-in Objects ...... 450 Indicators ...... 453 Splitters ...... 456 Duplicating on a Matrix...... 459 Using Object Methods with Fields and Objects ...... 462 Object Events ...... 463 Deleting an Object Method ...... 467 Adding a Subform to the Form ...... 468 Entering Data in a Subform ...... 469 Data Entry Options for Subforms ...... 470 Displaying Data in a Subform ...... 471 Creating a Subform ...... 471 Modifying a Subform source ...... 476
Chapter 7 Output Displays and Reports ...... 477 Output Forms for Listing Records ...... 477 Output Control Lines ...... 480 Moving Output Control Lines...... 483 Creating Output Forms ...... 484 Using the Form Wizard’s Advanced Options ...... 486
4th Dimension Design Reference 9
Contents
Modifying an Output Form in the Form Editor ...... 489 Displaying Several Lines Per Record ...... 490 Modifying Output Forms for Reports ...... 491 Printed Columnar Reports ...... 491 One Record Per Page Reports ...... 492 Using Subforms ...... 492 Report with a Text Field ...... 492 Custom Mailing Labels...... 493 Creating Mail-Merge Documents ...... 493 Basic Steps for Creating a Printed Report ...... 496 Reports with Breaks ...... 497 Creating Additional Control Lines...... 499 Initiating Break Processing...... 501 Reports with Subtotals ...... 501 Summary Reports ...... 505 An Example Report...... 506 Printing Subforms, Pictures, and Text Fields ...... 509 Printing Labels ...... 512
Chapter 8 Creating Methods ...... 517 4th Dimension Methods ...... 518 Object Methods ...... 518 Form Methods ...... 519 Triggers ...... 519 Database Methods ...... 521 Project methods ...... 522 Events...... 522 Database Methods ...... 524 Triggers ...... 524 Form and Object Events ...... 525 Introduction to Methods...... 527 Examples ...... 529 Where to Put an Object Method...... 533 Creating or Opening Methods ...... 534 Creating an Object Method ...... 534 Creating or Opening a Project Method ...... 535 Creating a Trigger ...... 537 Creating or Opening a Form Method ...... 538 Deleting methods ...... 540 Deleting a Project Method, a Form Method or a Trigger . 540 Clearing Unwanted Object Methods ...... 541 Defining the properties of project methods ...... 541 Renaming a Project Method ...... 542 Access and Owner privileges ...... 543
10 4th Dimension Design Reference
Contents
Making a Method Invisible ...... 544 Available through 4DACTION ...... 544 Offered as a Web Service ...... 545 Batch Setting for Method Attributes ...... 545 Using the Method Editor ...... 548 Using and configuring the Method editor window. . . . . 549 Writing a Method ...... 559 Creating and using macros ...... 577 Find and replace ...... 582 Importing and exporting methods ...... 585
Chapter 9 Creating Custom Menus ...... 589 Designing Menus ...... 589 Creating Menus ...... 591 Basic Steps for Creating Menus ...... 591 Default menu bars ...... 592 Creating a Menu Bar ...... 593 Adding Menus ...... 595 Adding Menu Commands...... 596 Rearranging Menus and Menu Commands ...... 598 Assigning Methods to Menu Commands ...... 598 Working With Instances of a Menu ...... 601 Creating Connected Menus ...... 602 Modifying Connected Menus ...... 602 Deleting Connected Menus ...... 603 Enhancing Menus ...... 603 Adding an Icon to a Menu Command ...... 604 Changing Font Styles ...... 604 Enabling and Disabling Menu Commands ...... 605 Adding Separator Lines ...... 606 Assigning Keyboard Shortcuts...... 607 Deleting Menus and Menu Commands ...... 609 Previewing Menu bars and Adding a Splash Screen...... 610 Menus and Custom Applications ...... 611
Chapter 10 Managing Password Access...... 613 Access System Overview ...... 614 An Access Hierarchy Scheme ...... 617 The Designer and the Administrator ...... 619 Group Owners ...... 620 Giving Users Design Environment Access...... 621 Giving Access to the User Environment ...... 621 Defining a Default User ...... 622
4th Dimension Design Reference 11
Contents
Initiating the System ...... 623 Assigning Users and Groups ...... 624 Adding Users ...... 624 Creating Access Groups ...... 626 Assigning Users to Groups ...... 627 Removing Users from Groups ...... 628 Nesting Groups...... 629 Removing Nested Groups ...... 629 Saving and Loading Groups ...... 630 Assigning a Group To Database Objects ...... 631 Assigning Access To Record Operations ...... 631 Assigning a Group to a Form ...... 633 Assigning a Group to a Project Method ...... 634 Assigning a Group to a Menu Command ...... 635 Assigning a Group to a Plug-in or to the 4D Client Web server 636 System Maintenance ...... 637 Administrator and Group Owner Access ...... 638 Viewing Usage ...... 638
Chapter 11 Creating Lists ...... 641 Designing Lists for Data Entry ...... 642 Hierarchical Lists ...... 644 Required and Excluded Values...... 645 Non-Sequential Ranges of Values ...... 645 Creating Lists ...... 646 Adding Items to Lists...... 647 Deleting Items and Lists ...... 650 Adding a Small Icon to an Item ...... 650 Adding a Reference ID to an Item ...... 651 Specifying Ranges in a List ...... 652 Sorting a List ...... 652 Specifying Font Attributes ...... 653 Making a Choice List Modifiable ...... 653 Enabled/Editable option ...... 655 Setting the Minimum Height of a List ...... 656 Dragging a List into a Form ...... 657
Chapter 12 Using the Picture Library ...... 659 Managing and Viewing Pictures ...... 659 Adding Pictures...... 661 Importing a Picture File ...... 661 Pasting a Picture from the Clipboard ...... 662
12 4th Dimension Design Reference
Contents
Creating a New Picture ...... 663 Setting Picture Properties ...... 663 Creating and Modifying Pictures ...... 664 Saving and Cancelling Modifications ...... 666 Creating Thumbnails ...... 666 Creating a Sequence of Frames ...... 667 Size of the Frames ...... 667 Viewing the Frames ...... 668 Inserting and Deleting Frames ...... 668 Shortcuts for Inserting Picture Buttons and Pop-up Menus 670
Chapter 13 Managing Processes ...... 671 Processes ...... 672 Processes Created and Managed by 4th Dimension. . . . . 673 Time-Sliced Execution...... 674 Starting a New Process...... 675 Starting a New Process Using New Process ...... 675 Starting a New Process Using the Menu Bar Editor . . . . . 676 Starting a New Process Using Execute Method ...... 678 Using The Process List ...... 679 Process Number ...... 681 Process Name ...... 681 Process Status ...... 683 Process Time ...... 684 Controlling Process Execution ...... 685 Pausing and Resuming a Process ...... 685 Aborting a Process ...... 685 Tracing a Process...... 686 Hiding a Process ...... 686 Bringing a Process to the Front ...... 687
Chapter 14 Compiling a Database ...... 689 Introduction ...... 689 What is a compiler? ...... 689 Why compile your database? ...... 691 Compilation in 4th Dimension ...... 693 Compiler window ...... 694 Compiler commands ...... 695 Options ...... 698 Compilation preferences ...... 700 Compilation diagnostic aids ...... 700 Symbol file...... 701 Error file ...... 703
4th Dimension Design Reference 13
Contents
Range checking...... 705 Diagnosing Anomalies ...... 707 Navigation between interpreted and compiled mode . . . . . 708
Chapter 15 Building Final Applications ...... 711 Application builder...... 713 Definition of the application name and destination . . . 715 Building a compiled database ...... 716 Building a double-clickable application ...... 717 Selection of the 4D Engine folder ...... 717 Licensed version and demo version ...... 718 Generated files ...... 719 Rebuilding a double-clickable application...... 719 Customizing the 4D Engine folder ...... 720 Customizing the application icon ...... 720
Chapter 16 Publishing or Using Web Services...... 723 Presentation ...... 723 What are Web Services? ...... 723 Operation of Web Services —main definitions ...... 724 Integration of Web Services in 4D ...... 724 Publishing a Web Service with 4th Dimension ...... 728 Creating a Web Service method ...... 729 Publication of methods ...... 729 Generation of the WSDL...... 731 Customizing a Web Service name ...... 732 Customizing a Namespace ...... 733 Adding comments to published methods ...... 734 Accessing a Web Service published by 4th Dimension . . 734 Subscribing to a Web Service in 4th Dimension ...... 736 Principles ...... 736 Using the Web Services Wizard ...... 737 Display of connection parameters ...... 744 Calling a proxy method ...... 745 Processing complex types ...... 745
Appendix A Segmenting Data Files ...... 749 Segmenting Data Files ...... 749 Segmenting a Data File ...... 750 Limiting Data Segment Size ...... 751 Adding a Data Segment While Indexing...... 752
14 4th Dimension Design Reference
Contents
Deleting Data Segments ...... 753 Deleting a New Data Segment...... 753 Deleting an Existing Data Segment ...... 754 Missing Data Segments ...... 754 Reconfiguring Data Segments ...... 755
Appendix B Assigning a Help File to a 4D Database ...... 757 Setting a Database On-line Help ...... 758 File Formats ...... 758 Assigning the Help File to the Database ...... 758 Creating Contextual On-line Help ...... 759 Calling the On-line Help from a Database ...... 759
Appendix C DTD for macros...... 761
Index...... 763
4th Dimension Design Reference 15
Contents
16 4th Dimension Design Reference
Preface
4th Dimension is a powerful relational database application, a complete multi-platform development tool and a dynamic Web server.
You can use 4th Dimension to manage your own data or develop custom applications for different kinds of database management tasks.
For example, you can: