REALbasic Cross-Platform Application Development By Mark Choate Publisher: Sams Pub Date: April 12, 2006 Print ISBN-10: 0-672-32813-5 Print ISBN-13: 978-0-672-32813-8 Pages: 672 Table of Contents | Index REALbasic Cross-Platform Application Development treats REALbasic as a serious development environment and is targeted to developers with a minimum of programming experience, but who may or may not be new to the REALbasic platform Written by a writer and developer with extensive REALbasic experience with input and guidance from REAL Software, this book will show you how to take advantage of the new cross-platform abilities of REALbasic and teach you how to create cross-platform applications Don't waste any more time with the other novice-oriented REALbasic books out there Get inside this development environment with REALbasic Cross-Platform Application Development REALbasic Cross-Platform Application Development By Mark Choate Publisher: Sams Pub Date: April 12, 2006 Print ISBN-10: 0-672-32813-5 Print ISBN-13: 978-0-672-32813-8 Pages: 672 Table of Contents | Index Copyright About the Author Acknowledgments We Want to Hear from You! Reader Services Introduction Chapter 1 Introduction to REALbasic What's New in REALbasic 2005 Deciding if REALbasic Is Right for You Strengths and Weaknesses Who Should Read This Book What You Can Expect Chapter 2 Programming with REALbasic Defining a Computer Program REALBasic Terminology Quick Start: A Simple Web Browser Procedural Programming in REALbasic Flow ControlConditionals Flow ControlLoops Variants Modules Creating the StringParser Module Summary Chapter 3 Classes and Objects The Class Hierarchy Creating a New Class Declaration and Instantiation Constructors and Destructors Garbage Collection Inheritance Object Operators Adding and Overriding Methods Calling the Overridden Method Overloading Casting Oddities Encapsulation Access Scope: Public, Private, Protected Setting Properties with Methods Default and Optional Parameters Declaring Variables Static and Const Revisiting the StringParser Module Example: Creating a Properties Class Data-Oriented Classes and Visual Basic Data Types Advanced Techniques Chapter 4 Cross-Platform Application Development That Other Cross-Platform Language Compiling REALbasic Applications Configuring the Compiler The App Class Files and Directory Organization Compiler Directives User Interface Differences System Module Windows Registry RSSReader Preferences Example A Final Word About Macintosh Summary Chapter 5 Designing a Desktop Application Integrated Development Environment Desktop Applications: Programming Graphical User Interfaces Model-View-Controller Windows and Controls Managing Windows Controls Exception Handling User Interface Response Menus and Menu Handlers CustomTray Summary Chapter 6 XML and Advanced Text Processing Encoding XML Processing Regular Expressions StyledText Summary Chapter 7 Console Programming and the Shell Sample Applications The Shell Class Developing Console Applications Conclusion Chapter 8 Databases The No-Code Database The Coded Database SQL Equivalents Conclusion Chapter 9 Networking and Internet Programming A Simplified View of a Computer Network The Protocol Stack The Internet REALbasic Networking Classes Network Object Network Interface Class System Members TCP and UDP Networks IPCSocket Class UDPSocket Conclusion Chapter 10 Graphics Raster and Vector Graphics Picture Class Canvas Control The Canvas ControlScrolling Text and Images Object2D Class Printing with REALbasic Summary Chapter 11 Scripting and Extending REALbasic Scripting Extending REALbasic Summary Appendix A Appendix Sample Code and Application GNU General Public License Terms and Conditions for Copying, Distribution, and Modification How to Apply These Terms to Your New Programs GNU Lesser General Public License Terms and Conditions for Copying, Distribution, and Modification How to Apply These Terms to Your New Libraries Online Resources Index Copyright REALbasic CrossPlatform Application Development Copyright © 2006 by Sams Publishing All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein Library of Congress Catalog Card Number: 2005902141 Printed in the United States of America First Printing: April 2006 09 08 07 06 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark REAL Software, REALbasic and the REAL Software cube logo are registered trademarks of REAL Software, Inc Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an "as is" basis Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales For more information, please contact U.S.Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales international@pearsoned.com Acquisitions Editor Scott Meyers Managing Editor Charlotte Clapp Project Editor George E Nedeff Copy Editor Barbara Hacha Indexer Aaron Black Proofreader Suzanne Thomas Technical Editor William H Murray Publishing Coordinator Vanessa Evans Multimedia Developer Dan Scherf Series Designer Gary Adair Page Layout Bronkella Publishing Michelle Mitchell About the Author Mark Choate is an author, educator, and consultant specializing in eBusiness and online publishing His experience includes eight years of Internet development and content management at The News and Observer Publishing Company, one of the very first news-papers in the country to publish a web edition Mark's particular area of expertise is with cross-media content management tools and XML For two years he has used REALbasic to develop cross-platform tools for use in online publishing Acknowledgments I would be remiss if I also did not mention two people to whom I am particularly indebted Both Connor Choate and Christine Goertz Choate provided patient support while I wrote the book They gave up more than a few weekends and vacations, and without their help I would not have been able to complete this book They both have my heartfelt thanks and sincere appreciation Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] Ubound function Arrays multidimensional Arrays Ubound functions, Array UCS-2 UCS-2/4 UCS-4 UDP (User Datagram Protocol) [See also TCP/UDP networks.] overview sending/receiving data SocketCore class UDPSocket class 2nd Unicode [See also Encodings object; UTF-8.] Unicode Transformation Format (UTF-8, UTF-16, UTF-32) Universal Character Set (UCS-2, UCS-4) Uniform Resource Locators [See URLs.] Uniform Type Identifiers (UTI) Universal Character Set (UCS-2, UCS-4) Universal Character Set (UCS-2/4) UNIX epoch etc directory FreeBSD support Shell class [See also Shell class.] other OSs, compared to UNIXlike systems UNIXlike systems [See also Linux and ; Macintosh.] Update Handles Event (DataControl controls) Update method DataControl controls RecordSets class Update statement (databases) UpperCase function URLs [See also Paths, overview.] CGI applications and FolderItems, referencing overview referencing files user directories, location of home directory User-defined data types (Visual Basic) UTF-8 UTF-8/16/32 (Unicode Transformation Format) [See also encoding (strings).] UTI (Uniform Type Identifiers) Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] Val function Valentina Validate property (DataControl controls) validating text with regular expressions ValidationError event, EditFields Value method (RegistryItem) Value property Canvas control PagePanel XMLNode Value value (ProgressBar) values (object-oriented programming languages) [See scalar references.] var directories, log files VarChar variable substitution with regular expressions in Properties class variables constants declaring 2nd instrinsic data types literals local variables object-oriented programming and properties [See also properties.] purpose of reference variables [See also object variables, reference variables.] compared to scalar variables scalar variables compared to reference variables Variant type, Date class and Variant value, ListBoxes Variants compared to integers methods operators and overview properties of VarType function when to use VarType function, Variants vector graphics [See also Graphics2D class.] Version Info section (App Properties pane) View menu, Editor Only MenuItem VirtualVolume Visible as Boolean property (REALbasic Windows) Visible property Visual Basic data types OLEContainer and Visual Basic data types, REALbasic class equivalents Visual Basic, history of Volume function VolumeCount function Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] WdSaveFormat constants Web browser sample application controls, adding 2nd events, associating with controls overview running Web server scripting (RBScript) web servers HTTPConnection class 2nd HTTPRequest class overview ServerSocket class HTTPServer HTTPServer, handling GET requests HTTPServer, handling POST requests 2nd HTTPServer, uploading files 2nd SSLSocket class TCP/UDP networks, ServerSocket class Well-Known Ports While, Wend statements Width property RectControl class Windows (REALbasic) Window class, Window1 class inheritance Window Editor mode, toggling to Window Editor option (IDE preferences menu) Window function Window subclass (Shell class) AntShell subclass and AntTargetView subclass 2nd Window Toolbar (IDE) Window1 class Edit Modes purpose of Window class, inheriting Window1 tab, editing Windows WindowCount function Windows application folders, location of configuration files, location of Declares document files, location of keyboard accelerators keyboard shortcuts log files, location of overview preference folder, location of Shell class [See also Shell class.] other OSs, compared to taskbar Tray, custom Tray example user directories, location of Windows (REALbasic) XP, special folders [See also SpecialFolder() function.] Windows (REALbasic) appearance properties CloseButton as Boolean property colors/backdrops Composite Windows FullScreen as Boolean property LiveResize as Boolean property MacProcID as Integer property MaximizeButton as Boolean property MenuBar as MenuBar1 property MenuBarVisible as Boolean property Resizable as Boolean property Title as String property Visible as Boolean property Controls [See controls.] editing FolderItemDialog/SelectFolderDialog/OpenDialog/SaveAsDialog classes FrameType properties Document Windows Drawer Windows Floating Windows Global Floating Windows Macintosh Sheet Windows Modal Windows 2nd overview Plain Box Windows shadowed box/rounded Windows GetOpenFolderItem/GetSaveFolderItem/SelectFolder functions global window functions ID properties MenuBars, associating with MessageDialog class mouse pointers MsgBox function overview position properties states of Windows class Windows class [See also Windows (REALbasic).] Windows Registry data types HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS Windows Settings section (App Properties pane) MDI window overview WindowsAppName Windows XP, environment variables [See also environement variables.] WindowsAppName (App Properties pane) WindowsPreferences class WordApplication class BuiltInDocumentProperties object Documents collection ActiveDocument property Add method Close method Open method Save method SaveAs method overview WordApplication class (OLEObject) World Wide Web [See Internet.] HTTP IP addresses overview ports protocol stacks URLs Write method cgiRequest class SSLSocket Write method (TCPSocket) write() method (SubscribedFeeds class) Writeable interface, command-line XML transformer and WriteLine method (Shell class) WriteLine() function (TextOutputStreams) writerError() method (SubscribedFeeds class) Wstring (MemoryBlock class) www [See World Wide Web, HTTP.] Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] xDoc.CreateElement method xDoc.toString method XML anatomy of attribute node CDATA section comment node DOCTYPE declaration node Document node, overview element node encoding entity references HTML, converting to processing instruction node text node XML declaration node XPATH [See also XPATH.] XML declaration node, overview XML transformer [See command-line XML transformer.] XmlDecl(version as String, xmlEncoding as String, standalone as Boolean) handles event XMLDocument [See also XMLNode.] overview purpose of XMLReader, comparing to XMLDocument class as model (MVC) XMLDocument.DocumentElement property XMLElement, declaring namespace XMLNode [See also XMLDocument.] methods properties xmlns property XMLReader Constructors overview purpose of rbXmlReader input XML file output overview 2nd XMLDocument, comparing to XmlReader subclass (Ant application) XMLReaders mwXmlReader class object instantiation 2nd 3rd state management XPATH [See also XSLT, overview.] XQL method XSLT, overview Index [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] zero-width matches, regular expressions .. .REALbasic Cross- Platform Application Development By Mark Choate Publisher: Sams Pub Date: April 12, 2006 Print ISBN- 10: 0-672-32813-5 Print ISBN- 13: 978-0-672-32813-8... Data-Oriented Classes and Visual Basic Data Types Advanced Techniques Chapter 4 Cross- Platform Application Development That Other Cross- Platform Language Compiling REALbasic Applications Configuring the Compiler The App Class... How to Apply These Terms to Your New Libraries Online Resources Index Copyright REALbasic CrossPlatform Application Development Copyright © 2006 by Sams Publishing All rights reserved No part of this book shall be reproduced,