Cincom Smalltalk ™ GUI Developer's Guide P46-0136-07 S I M P L I F I C A T I O

Cincom Smalltalk ™ GUI Developer's Guide P46-0136-07 S I M P L I F I C A T I O N T H R O U G H I N N O V A T I O N ® Copyright © 1993–2009 by Cincom Systems, Inc. All rights reserved. This product contains copyrighted third-party software. Part Number: P46-0136-07 Software Release 7.7 This document is subject to change without notice. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. Trademark acknowledgments: CINCOM, CINCOM SYSTEMS, and the Cincom logo are registered trademarks of Cincom Systems, Inc. ParcPlace and VisualWorks are trademarks of Cincom Systems, Inc., its subsidiaries, or successors and are registered in the United States and other countries. ObjectLens, ObjectSupport, ParcPlace Smalltalk, Database Connect, DLL & C Connect, and COM Connect are trademarks of Cincom Systems, Inc., its subsidiaries, or successors. ENVY is a registered trademark of Object Technology International, Inc. All other products or services mentioned herein are trademarks of their respective companies. Specifications subject to change without notice. The following copyright notices apply to software that accompanies this documentation: VisualWorks is furnished under a license and may not be used, copied, disclosed, and/or distributed except in accordance with the terms of said license. No class names, hierarchies, or protocols may be copied for implementation in other systems. This manual set and online system documentation copyright © 1993–2009 by Cincom Systems, Inc. All rights reserved. No part of it may be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior written consent from Cincom. Cincom Systems, Inc. 55 Merchant Street Cincinnati, Ohio 45246 Phone: (513) 612-2300 Fax: (513) 612-2000 World Wide Web: http://www.cincom.com GUI Developer’s Guide iii Contents About This Book xv Audience ................................................................................................................... xv Conventions .............................................................................................................. xv Typographic Conventions ............................................................................. xv Special Symbols ...........................................................................................xvi Mouse Buttons and Menus ..........................................................................xvi Getting Help .............................................................................................................xvii Commercial Licensees ................................................................................xvii Before Contacting Technical Support .............................................xvii Contacting Technical Support ........................................................xvii Non-Commercial Licensees .......................................................................xviii Additional Sources of Information .............................................................................xix Online Help ..................................................................................................xix VisualWorks FAQ .........................................................................................xix News Groups ...............................................................................................xix Commercial Publications .............................................................................. xx Examples ..................................................................................................... xx Chapter 1 Building an Application’s GUI 1-1 Separating Domain and Application Models ............................................................1-1 GUI Development .....................................................................................................1-2 Loading the UI Painter ..............................................................................................1-2 Creating a Graphical User Interface .........................................................................1-2 “Painting” a Window ....................................................................................1-3 Setting Properties .......................................................................................1-4 Installing the Canvas ...................................................................................1-6 Reopening a Canvas ...................................................................................1-7 Defining Value Models ................................................................................1-8 Testing the User Interface ...........................................................................1-9 iv VisualWorks Formatting a Canvas ............................................................................................... 1-9 Setting the Window Size ........................................................................... 1-10 Setting the Window Opening Position ....................................................... 1-10 Adding Scrollbars to a Window ................................................................. 1-11 Adding a Menu Bar ................................................................................... 1-11 Adding Fly-by Help ................................................................................... 1-12 Setting the UI Colors ................................................................................. 1-12 Sizing a Widget ......................................................................................... 1-14 Making a Widget’s Size Fixed ................................................................... 1-15 Making a Widget’s Size Relative ............................................................... 1-15 Applying Explicit Boundaries to an Unbounded Widget ............................ 1-16 Positioning a Widget .............................................................................................. 1-16 Making a Widget’s Origin Fixed ................................................................ 1-17 Giving an Unbounded Widget a Fixed Position ............................ 1-17 Making a Widget’s Origin Relative ............................................................ 1-18 Giving an Unbounded Widget a Relative Position ....................... 1-18 Grouping Widgets .................................................................................................. 1-19 Making a Group of Widgets ...................................................................... 1-19 Editing Widgets in Groups ........................................................................ 1-20 Aligning Widgets .................................................................................................... 1-20 Distributing Widgets ............................................................................................... 1-21 Changing a Widget’s Font ...................................................................................... 1-21 Named Fonts ............................................................................................ 1-22 Changing the Tabbing Order .................................................................................. 1-23 Opening and Closing Windows .............................................................................. 1-24 Opening the Main Window ........................................................................ 1-24 Opening a Secondary Window ................................................................. 1-25 Setting the Window Size at Opening ........................................................ 1-26 Setting the Startup Location of a Window ................................................ 1-26 Closing Application Windows ....................................................... 1-26 Hiding a Window ....................................................................................... 1-27 Performing Final Actions .......................................................................... 1-27 Chapter 2 The VisualWorks GUI Environment 2-1 UI Painter ................................................................................................................ 2-2 The Canvas ............................................................................................................. 2-3 The Palette .............................................................................................................. 2-3 GUI Painter Tool ...................................................................................................... 2-4 Chapter 3 Controlling the GUI Programmatically 3-1 Application Startup and Shutdown .......................................................................... 3-1 Launching an Application ........................................................................... 3-2 GUI Developer’s Guide v Prebuild Intervention ...................................................................................3-2 Postbuild Intervention ..................................................................................3-3 Postopen Intervention .................................................................................3-3 Application Cleanup ....................................................................................3-3 Windows ...................................................................................................................3-4 Creating a Window ......................................................................................3-4 Class Hierarchy ...........................................................................................3-5 Window Components ..................................................................................3-5 Controller ........................................................................................3-6 Component .....................................................................................3-6 Event Sensor ..................................................................................3-6 Manager .........................................................................................3-6 Window Processes ......................................................................................3-6 Yielding to Other Processes ........................................................................3-7 Accessing Window Components .................................................................3-8 Accessor Methods ..........................................................................3-9 Accessing a Window .................................................................................3-10 Getting an Application Window ....................................................3-10 Getting the Active Window ...........................................................3-10 Getting the Window at a Location ................................................3-11 Closing a Window .........................................................................3-11 Setting Window Properties ........................................................................3-11 Changing the Window Size .........................................................3-12 Determining a Window’s Dimensions ...........................................3-12 Changing a Window’s Label .........................................................3-12 Adding and Removing Scroll Bars ...............................................3-12 Controlling Window Displays .....................................................................3-13 Refreshing a Window’s Display ....................................................3-13 Expanding and Collapsing a Window ...........................................3-13 Assigning a Window Icon ..........................................................................3-14 Creating an Icon ...........................................................................3-14 Registering an Icon ......................................................................3-14 Installing an Icon ..........................................................................3-15 Slave and Master Windows ......................................................................3-15 Make Windows Equal Partners ....................................................3-16 Choosing the Events That Are Sent .............................................3-16 Choosing the Events That Are Received ......................................3-16 Window Events ..........................................................................................3-17 Registering Window Events ......................................................................3-22 Adding an Event to the UI Event Queue ....................................................3-23 Controlling Widgets ................................................................................................3-25 Accessing a Widget ..................................................................................3-25 Accessing the Widget’s Wrapper ..............................................................3-25 vi VisualWorks Setting Widget Properties ......................................................................... 3-26 Changing a Widget’s Size ........................................................... 3-26 Changing a Widget’s Font ............................................................ 3-27 Hiding a Widget ........................................................................... 3-27 Disabling a Widget ....................................................................... 3-28 Changing a Widget’s Colors ....................................................... 3-29 Adding and Removing Dependencies ...................................................... 3-29 Adding a Dependency ................................................................. 3-30 Removing a Dependency by Retracting the Interest .................. 3-30 Bypassing All Dependencies ....................................................... 3-31 Validation Properties ................................................................................. 3-31 Notification Properties .............................................................................. 3-32 Giving a Widget Keyboard Focus ............................................................. 3-33 Chapter 4 Adapting Domain Models to Widgets 4-1 Value Models ........................................................................................................... 4-1 Choosing a Value Model ............................................................................. 4-2 Configuring a ValueHolder ....................................................................................... 4-3 Configuring an AspectAdaptor ................................................................................. 4-5 Configuring an AspectAdaptor with a Subject ............................................ 4-5 Configuring an AspectAdaptor with a Subject Channel .............................. 4-6 Adapting Unconventional Accessors .......................................................... 4-8 Adapting a Changing Domain ..................................................................... 4-9 Configuring a PluggableAdaptor ............................................................................ 4-10 Configuring Accessor Blocks .................................................................... 4-11 Configuring the Update Block ................................................................... 4-12 Synchronizing Updates (BufferedValueHolder) ..................................................... 4-13 Adding a BufferedValueHolder ................................................................. 4-13 Discarding the Buffered Values ................................................................ 4-15 Adapting Collections ............................................................................................. 4-15 Adapting to a SelectionInList .................................................................... 4-16 Adapting a Indexable Collection .............................................................. 4-17 Adapting Collections of Collections .......................................................... 4-18 Defining Adaptors in the UI Painter ....................................................................... 4-20 Aspect Path with Aspect Selectors ........................................................... 4-20 Aspect Path with Index Selectors ............................................................. 4-22 Aspect Path with Input Buffering ............................................................... 4-22 Configuring Dependencies Using Events .............................................................. 4-23 Registering an Interest in a Widget Event ................................................ 4-23 Update Notifications using Events ............................................................ 4-24 GUI Developer’s Guide vii Chapter 5 Custom Views 5-1 Creating a View Class .............................................................................................5-1 Connecting a View to a Domain Model ....................................................................5-2 Defining What a View Displays ................................................................................5-3 Updating a View When Its Model Changes ..............................................................5-4 Connecting a View to a Controller ............................................................................5-5 Creating a Controller Class .........................................................................5-5 Connect the Controller to the Model ...........................................................5-7 Connect the Controller to the View ..............................................................5-7 Connecting a Composite View to a Controller .............................................5-8 Redisplaying All or Part of a View ............................................................................5-8 Redisplaying a View ....................................................................................5-9 Integrating a View into an Interface ..........................................................................5-9 Chapter 6 Dialogs 6-1 SimpleDialog ............................................................................................................6-1 Core Structures ...........................................................................................6-2 Simple Dialog Construction .........................................................................6-2 Standard Dialogs ......................................................................................................6-3 Warning Dialog ............................................................................................6-3 Confirmation Dialog .....................................................................................6-3 Multiple-Choice Dialog ................................................................................6-4 Text Response Dialog .................................................................................6-5 File Dialogs ..............................................................................................................6-6 Open File Dialog .........................................................................................6-6 Handling File Existence Condiitons .............................................................6-7 Password Dialog ......................................................................................................6-8 Creating a Custom Dialog ........................................................................................6-9 Providing a Temporary Model for the Dialog ...............................................6-9 Visually Linking a Dialog to a Master Window ........................................................6-10 Chapter 7 Menus 7-1 Creating a Menu .......................................................................................................7-1 Creating a Menu using the Menu Editor ......................................................7-2 Creating a Menu Programmatically .............................................................7-3 Adding Menus to the User Interface .........................................................................7-5 Adding a Menu Bar to a Window .................................................................7-5 Adding a Menu Button .................................................................................7-6 Adding a Popup Menu to a Widget ..............................................................7-6 Adding a Menu Bar or Pop-Up Menu of Values ...........................................7-6 Accessing Menus Programmatically ........................................................................7-7 viii VisualWorks Modifying a Menu Dynamically ................................................................................ 7-9 Disabling a Menu Item ................................................................................ 7-9 Hiding a Menu Item ..................................................................................... 7-9 Adding an Item to a Menu ......................................................................... 7-10 Removing an Item from a Menu ............................................................... 7-10 Substituting a Different Menu ................................................................... 7-11 Displaying an Icon in a Menu ................................................................................. 7-12 Adding an Icon to a Menu ......................................................................... 7-12 Displaying an On/Off Indicator .................................................................. 7-13 Adding a Group with a Single Indicator .................................................... 7-14 Toolbars ................................................................................................................. 7-15 Creating a Tool Bar Image ........................................................................ 7-15 Adding a Toolbar ....................................................................................... 7-17 Modifying a Toolbar Dynamically .............................................................. 7-18 Disabling a Toolbar Button ........................................................... 7-18 Hiding a Toolbar Button ............................................................... 7-18 Changing a Toolbar Button Image ............................................... 7-19 Displaying an On/Off Indication ................................................... 7-20 Adding a Group of Buttons with a Single Selection ................................. 7-21 Extending Menus and Toolbars ............................................................................. 7-21 Pragma Parameters .................................................................................. 7-22 Menu Pragma Forms ................................................................................ 7-24 Minimal Menu Pragma ................................................................. 7-26 Menu Label as a UserMessage ................................................... 7-26 Including a Shortcut Key .............................................................. 7-27 Add Enablement and Selection Indicators .................................. 7-28 Adding an Icon ............................................................................. 7-29 Adding Fly-by Help ...................................................................... 7-29 Submenu pragmas ...................................................................... 7-30 Computed Submenu Pragma ...................................................... 7-31 Adding Items to an Application's Menu or Tool Bar ................................. uploads/s1/ guide-v-guide.pdf

  • 29
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager
  • Détails
  • Publié le Fev 05, 2021
  • Catégorie Administration
  • Langue French
  • Taille du fichier 3.3596MB