ebook img

REALbasic cross-platform application development Includes index PDF

673 Pages·2006·5.811 MB·English
by  ChoateMark S
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview REALbasic cross-platform application development Includes index

REALbasic Cross-Platform Application Development Mark Choate DEVELOPER’S LIBRARY Sams Publishing,800 East 96th Street,Indianapolis,Indiana 46240 REALbasic Cross-Platform Application Acquisitions Editor Development Scott Meyers Copyright © 2006 by Sams Publishing Managing Editor Charlotte Clapp All rights reserved.No part of this book shall be reproduced,stored in a retrieval system,or transmitted by any means,electronic, Project Editor mechanical,photocopying,recording,or otherwise,without written George E.Nedeff permission from the publisher.No patent liability is assumed with Copy Editor respect to the use of the information contained herein.Although Barbara Hacha every precaution has been taken in the preparation of this book,the Indexer publisher and author assume no responsibility for errors or omis- Aaron Black sions.Nor is any liability assumed for damages resulting from the use of the information contained herein. Proofreader Suzanne Thomas International Standard Book Number:0-672-32813-5 Library of Congress Catalog Card Number:2005902141 Technical Editor William H.Murray Printed in the United States of America Publishing Coordinator First Printing:April 2006 Vanessa Evans 09 08 07 06 4 3 2 1 Multimedia Developer Trademarks Dan Scherf All terms mentioned in this book that are known to be trademarks Series Designer or service marks have been appropriately capitalized.Sams Gary Adair Publishing cannot attest to the accuracy of this information.Use of a Page Layout term in this book should not be regarded as affecting the validity of Bronkella Publishing any trademark or service mark.REAL Software,REALbasic and the Michelle Mitchell 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 infor- mation 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 [email protected] For sales outside of the U.S.,please contact International Sales [email protected] Contents at a Glance Introduction 1 1 Introduction to REALBasic 5 2 Programming with REALbasic 11 3 Classes and Objects 83 4 Cross-Platform Application Development 143 5 Designing a Desktop Application 213 6 XML and Advanced Text Processing 321 7 Console Programming and the Shell 407 8 Databases 451 9 Networking and Internet Programming 489 10 Graphics 533 11 Scripting and Extending REALbasic 571 A Appendix 597 Index 615 iv Contents Table of Contents Introduction 1 Chapter 1,Introduction to REALbasic 1 Chapter 2,Introduction to Programming with REALbasic 1 Chapter 3,Classes and Objects 2 Chapter 4,Cross-Platform Application Development 2 Chapter 5,Designing a Desktop Application 2 Chapter 6,XML and Advanced Text Processing 2 Chapter 7,Console Programming and the Shell 2 Chapter 8,Databases 2 Chapter 9,Networking and Internet Programming 2 Chapter 10,Graphics 3 Chapter 11,Scripting and Extending REALbasic 3 Appendix 3 1 Introduction to REALbasic 5 What’s New in REALbasic 2005 6 Deciding if REALbasic Is Right for You 6 Strengths and Weaknesses 7 Who Should Read This Book 8 What You Can Expect 8 2 Programming with REALbasic 11 Defining a Computer Program 11 REALBasic Terminology 12 Quick Start:A Simple Web Browser 14 Controls 15 Events 17 Run Your Application 18 Procedural Programming in REALbasic 18 Statements and Declarations and Comments 19 Expressions:Operands and Operators 19 Variables and Literals 20 Intrinsic Data Types 21 Contents v Declaration 22 Variables and Constants 23 Arithmetic with Integers,Singles, and Doubles 24 Strings 31 Color 32 Literals 32 Visual Basic Data Types 33 Methods 34 Arrays 35 Flow Control—Conditionals 43 If…Then 43 If…Then…Else 43 If…Then…Elseif…Then 43 Select Case 44 Flow Control—Loops 46 Do…Loop 46 Do…Loop Until 47 Do Until…Loop 47 For Each…Next 48 For…Next…Step 48 While…Wend 50 Using Loops 51 Nesting Loops 51 Variants 52 Variants and Operators 52 Properties 53 Methods 54 VarType 55 When to Use Variants 56 Modules 58 Built-in Modules 58 Built-in Math Functions 58 Built-in String Functions 61 Creating the StringParser Module 72 Create a New Project 72 Creating a Module 73 vi Contents Access Scope 74 Constants 75 Properties 76 Adding a Method 77 Adding the “Split”Method 77 Summary 81 3 Classes and Objects 83 The Class Hierarchy 83 Creating a New Class 87 Declaration and Instantiation 88 Constructors and Destructors 89 Garbage Collection 91 Inheritance 92 Object Operators 93 Adding and Overriding Methods 94 Calling the Overridden Method 95 Overloading 95 Casting 96 Oddities 97 Encapsulation 100 Access Scope:Public,Private,Protected 102 Setting Properties with Methods 103 Default and Optional Parameters 103 Declaring Variables Static and Const 104 Const 104 Static 104 Revisiting the StringParser Module 104 The Dictionary Class 107 The Properties File Format 108 Example:Creating a Properties Class 111 Properties.Constructor 111 Properties.get 112 Properties.set 114 Properties.parsePropertyFile 114 Properties.parseLine: 115 Contents vii Data-Oriented Classes and Visual Basic Data Types 117 Date Class 117 MemoryBlock Class 120 Collection Class 125 Advanced Techniques 126 Interfaces and Component-Oriented Programming 126 Custom Operator Overloading 135 Extends 141 Conclusion 141 4 Cross-Platform Application Development 143 That Other Cross-Platform Language 144 AWT 144 Swing 144 SWT 145 Compiling REALbasic Applications 145 A Note About UNIXlike Systems 146 The RSS Reader Application 146 Compiling Applications 146 Configuring the Compiler 149 Next Steps 151 The App Class 151 App Properties Pane 151 Files and Directory Organization 158 FolderItem Class 159 Referencing a FolderItem:Paths and URLs 159 How Folders and Files Are Organized 164 File Types 173 Volume and VolumeCount Functions 175 Navigating the Directory Tree 175 File Properties 176 Permissions and File Access 178 Moving,Copying,and Deleting Files 180 Opening,Creating,and Saving Files 183 viii Contents Compiler Directives 186 User Interface Differences 188 Windows:Taskbar 190 Macintosh:Dock 191 Linux:Pane (KDE and Gnome) 192 Keyboard 192 Menu Bar 196 Screen 196 System Module 198 Environment Variables 198 Line Endings 203 Windows Registry 204 RSSReader Preferences Example 205 Exporting and Importing Items 205 Creating the Preferences Class 206 A Final Word About Macintosh 211 Summary 212 5 Designing a Desktop Application 213 Integrated Development Environment 214 IDE MenuItems 214 Preferences 217 Find and Replace 219 Desktop Applications:Programming Graphical User Interfaces 219 Event-Driven Programming 220 Controls and Events 221 App Events 222 Model-View-Controller 224 Organizing Your Code 224 The RSSReader Application 225 Controller 226 The Model 229 Views 239 Windows and Controls 239 Simple Windows 239 Editing Windows 244 Global Window Functions 246 Contents ix Windows ID Properties 246 Windows Position Properties 247 Windows Appearance Properties 249 Managing Windows 256 Window States 256 Mouse Position 257 Controls 258 The RectControl Class 258 Control Order and Control Arrays 262 Drawing Guides 263 Binding 263 Pushbutton Control 266 TabPanel 266 EditField Control 268 ListBox 277 HTMLViewer Control 296 HTTPSocket Control 296 ProgressBar 297 Exception Handling 298 Runtime Exceptions 298 Try…Catch…End/Finally 299 Logging 300 Debugger 302 User Interface Response 305 Timers 305 Menus and Menu Handlers 312 Adding Menu Constants 313 Adding the MenuItems 314 Adding Menu Handlers 316 Windows and MenuBars 319 CustomTray 319 Summary 320 6 XML and Advanced Text Processing 321 Encoding 321 Byte Order Mark 324 Converting Encodings 324

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.