27
■ ■ ■ PART 4 Appendixes

Appendixes - Springer

Embed Size (px)

Citation preview

■ ■ ■

P A R T 4

Appendixes

347

■ ■ ■

A P P E N D I X A

Migrating Visual Basic Projects to REALbasic

If you are a Visual Basic programmer looking to make the jump to REALbasic, you probably have Visual Basic applications you want to migrate over as well. REALbasic and Visual Basic share a great many similarities. As such, there is no reason why you cannot convert most of your applications over to REALbasic. This way, not only can you run them on Windows, but you also can port them over to Macintosh and Linux.

Specifically, you learn

• How to prepare your Visual Basic code for migration

• How to import Visual Basic projects into REALbasic projects

• How to use the REALbasic Project Converter

Porting Visual Basic Projects to REALbasicDepending on the size and complexity of your Visual Basic projects, the challenge of convert-ing your applications may seem daunting. However, you can do a number of things to make the process go smoother and to save yourself considerable time and effort.

You should be able to reuse most of your Visual Basic code in your new REALbasic appli-cations. However, many little differences exist between the two programming languages. This should not be surprising given Microsoft’s Windows centric approach to programming language implementation. REALbasic, on the other hand, has been implemented using a cross-platform approach that stresses code portability.

348 A P P E N D I X A ■ M I G R A T I N G V I S U A L B A S I C P R O J E C T S T O R E A L B A S I C

A sampling of differences between Visual Basic and REALbasic include the following:

• Differences in supported data types. For example, Visual Basic supports the Long data type and REALbasic does not. Instead, you should use REALbasic Integer data type. Visual Basic also supports the Currency data type, for which REALbasic has no equivalent.

• Differences in classes and data types. For example, in REALbasic the Date is handled as a class, whereas in Visual Basic, the Date is made available as a built-in data type.

• Differences in variable declaration. REALbasic forces you to declare all variables using the Dim keyword. Visual Basic enables you to dynamically create variables, making Option Explicit an optional statement.

• Differences in variable naming rules. In REALbasic, variable names must begin with a letter and are made up of alphanumeric characters. However, Visual Basic variable names can also contain special characters (%, @, &, $, and so forth) leading to potential conflicts.

• Differences in keywords. A valid variable in one language may result in a keyword con-flict in the other language.

• Differences in operators. For example, in Visual Basic, concatenation is performed using the ampersand (&) character, whereas REALbasic uses the plus (+) character.

• Differences in the way some keywords are implemented. For example, in Visual Basic, the Mid function can be used to return a substring or to perform a substring replace-ment. In REALbasic, the Mid function can only be used to return a substring.

• Differences in the naming of the same functions. For example, REALbasic has LowerCase and UpperCase functions, whereas Visual Basic has LCase and UCasefunctions.

• Differences in the application of conditional logic. Unlike Visual Basic, REALbasic does not support single line Case statements.

• Differences in the formation of loops. REALbasic does not support the setup of a loop index on the Next statement in a For…Next loop the way Visual Basic does. Visual Basic supports the creation of loops that iterate negatively, using the To and Step keywords. REALbasic replaces these keywords with the DownTo keyword.

• Differences in how functions operate. Visual Basic allows functions to return a result by setting a value equal to the name of the function. REALbasic requires you to use the Return statement.

• Differences in how parameters are supported. Instead of supporting optional parame-ters, REALbasic provides the capability to set up default values for parameters.

• Differences in file system access. Visual Basic using a Windows-specific approach to accessing the file system, whereas REALbasic uses an operating system independent-access approach.

A P P E N D I X A ■ M I G R A T I N G V I S U A L B A S IC P R O JE C T S T O R E A LB AS I C 349

As you can see from this brief sampling, the differences between Visual Basic and REAL- basic are far too numerous to outline in this appendix. Instead, this appendix is designed to provide you with an overview of your options for converting Visual Basic projects to REALbasic projects and to outline the basic steps involved.

Doing a Little Prep WorkYou can take a number of simple steps prior to converting your program code that can signifi-cantly simplify the migration process. For starters, review your Visual Basic code and, if necessary, change it so all variables are formally declared. Also, ensure that all variable names conform to REALbasic’s rules. You should spend a little time checking on the data types being used, as well, and change them if necessary. And, while you’re at it, keep an eye on variable names, as well as subroutine and function names to make sure they are not in conflict with any REALbasic keywords.

Importing Visual Basic ProjectsREALbasic provides you with the capability to import any Visual Basic 2 or later form, along with all associated code into REALbasic projects. In doing so, REALbasic automatically re-creates Visual Basic forms as REALbasic windows. In addition, REALbasic creates event handlers and methods to store any program code imported along with the Visual Basic forms.

The following procedure outlines the steps involved in importing a Visual Basic form into a REALbasic project:

1. Locate the Visual Basic form you want to import.

2. Create a new REALbasic project or open the REALbasic project into which you want to import a Visual Basic form.

3. Drag-and-drop the Visual Basic form into the REALbasic Project Editor screen.

Depending on the complexity of the program code imported along with a Visual Basic form, you may not need to do anything else to get your project to compile under REALbasic. In most cases, though, you’ll have some code statements that REALbasic was unable to convert. To find out, try to compile your new REALbasic application and, if necessary, fix any reported errors.

REALbasic’s Project Converter UtilityIn addition to importing your Visual Basic forms directly into REALbasic projects, you can use the Visual Basic Project Conversion Utility to assist in the conversion of entire Visual Basic projects to REALbasic projects. This utility is available free: simply download it from the REALbasic web-site (www.realbasic.com/downloads/). According to its documentation, the Visual Basic Conversion Utility is designed to assist in converting Visual Basic 4.x to 6.x projects to REALbasic projects. This utility is not intended as a tool for converting Visual Basic .NET applications.

You install the Visual Basic Project Conversion Utility by downloading and decompressing it in the desired location on your computer. Once installed, you can use it to convert Visual Basic projects by dragging-and-dropping the Visual Basic projects on to the utility. The utility

350 A P P E N D I X A ■ M I G R A T I N G V I S U A L B A S I C P R O J E C T S T O R E A L B A S I C

then analyzes all the Visual Basic project’s files. The Visual Basic Project Converter Utility auto-matically converts Visual Basic projects, forms, classes, modules, and program code into equivalent REALbasic projects, windows, classes, modules, and program code.

Although, this utility can completely convert simple Visual Basic projects to REALbasic projects, it cannot convert most projects without a little help on your part. For example, you will probably have to rewrite certain portions of program code. In addition, any controls found in Visual Basic applications for which corresponding controls do not exist in REALbasic need to be converted to Canvas controls, leaving it up to you to create your own replacement con-trols or equivalent functionality. The Visual Basic Project Converter Utility’s database support is limited. Any database connections found in a Visual Basic project will not be re-created within REALbasic projects. Neither will a database be added to your REALbasic project. Instead, you must go back and reestablish the database connection, and then reset the DataField and DataSource properties for all controls bound to the database.

351

■ ■ ■

A P P E N D I X B

What’s on the CD-ROM?

When it comes to being a good REALbasic programmer, no substitute exists for hands-on experience in creating and testing REALbasic applications. It helps to have a collection of application source code from which you can learn and experiment. By studying and copying code examples from other REALbasic projects, you can also save time when creating new applications. This book’s companion CD-ROM provides access to all the sample applications presented in this book.

This book’s companion CD-ROM also provides you with convenient access to copies of REALbasic 2006 for Macintosh, Windows, and Linux.

REALbasic Program Source CodeThis book was written with the intention that you create and experiment with each of the sam-ple applications presented in the chapters as you make your way through the book. However, in the event that you may not have had the time to create and test every application presented, you can find copies of each sample application on this book’s companion CD-ROM.

Table B-1 provides you with a quick review of each of the sample applications you will find.

Table B-1. REALbasic Projects Available on This Book’s Companion CD-ROM

Chapter Application/Project Description

Chapter 1 Hello World.rbp A Hello World! Application

Chapter 2 RBBookFinder.rbp The RBBookFinder Browser

Chapter 3 RBClock.rbp A Desktop Clock Application

Chapter 4 RBQuickNote.rbp The RBQuickNote StickyPad Application

Chapter 5 RBCalculator.rbp A Desktop Calculator

Chapter 6 RB NumberGuess.rbp The RB Number Guess Game

Chapter 7 RB Movie Player.rbp The RB Movie Player

Chapter 8 Picture Viewer.rbp The RB Picture Viewer

StatesListbox.rbo A custom ListBox Control of State Names

Chapter 9 RB Word Processor.rbp The RB Word Processor

Continued

352 A P P E N D I X B ■ W H A T ’ S O N T H E C D - R O M ?

Table B-1. Continued

Chapter Application/Project Description

Chapter 10 DBBuilder.rbp The RB Book Database Setup Application

DBAdd.rbp The RB Book Database Add New Books Front End

Chapter 11 RB Painter.rbp The RB Draw Application

RB MP3 Player.rbp The RB MP3 Player

RB Speech.rbp A Speech Synthesizer Application

RB Piano Player.rbp A Minivirtual Piano

Chapter 12 Network Interface Checker.rbp The Network Connection Checker

353

■ ■ ■

A P P E N D I X C

What’s Next?

Congratulations on completing Beginning REALbasic. Learning a new programming language is a significant achievement and represents a major effort. But, don’t look at the completion of this book as the end of your REALbasic education. You have plenty more to learn! To help keep your momentum going, this appendix provides you with information about different resources you may want to consider pursuing to further develop your REALbasic programming skills.

Locating REALbasic Resources OnlineMany websites are dedicated to REALbasic, and some are better than others. The following sec-tions outline a number of good sites. Along with the name and web address of each site, you’ll find a brief description of what you can expect to find.

REALbasic UniversityThe REALbasic University website, located at www.applelinks.com/rbu/, provides access to a weekly online column dedicated to Macintosh software development using REALbasic. This website is a great source for learning new programming techniques and getting tips on how to do things differently.

RBDocsThe RBDocs website, located at www.rbdocs.com, is an online community where you can find a collaborative collection of REALbasic documentation. This website’s goal is to provide more detailed documentation than is provided in the REALbasic Reference.

RBGarageThe RBGarage website, located at www.rbgarage.com, provides access to over 1,000 different links to REALbasic resources, including links to plug-ins, modules, sample code, and tutorials.

354 A P P E N D I X C ■ W H A T ’ S N E X T ?

VBZoneThe VB Zone RB website, located at rb.thevbzone.com/, provides access to sample REALbasic projects and tons of sample code. You’ll also find a good collection of programming lessons and links to other REALbasic resources.

REALbasic GazetteThe REALbasic Gazette website, located at rbgazette.com/, is a web log where you can go to find REALbasic news. This website also provides a huge supply REALbasic programming tips and program code.

Really Basic REALbasicThe Really Basic REALbasic website, located at www.ttpsoftware.com/ReallyBasicRB/, is devoted to providing beginner REALbasic programmers with sample projects, code snippets, and tutorials, as well as other useful resources for those just getting started.

REALOPENThe REALOPEN website, located at realopen.org/, is a public open-source repository for REALbasic code. The REALOPEN website’s main function is to provide a collaborative environ-ment in which REALbasic software developers can organize and share access to projects. But, this is also a great place to find plenty of REALbasic news.

Realgurus.comThe Realgurus.com website, located at realgurus.com/board/, provides access to forums where you can access thousands of online discussions about REALbasic programming.

REALbasic Developer MagazineAnother excellent source for cutting-edge information and REALbasic is the REALbasic Developermagazine, which you can subscribe to by visiting www.rbdeveloper.com, as shown in Figure C-1. REALbasic Developer magazine provides access to an assortment of articles of interest to both beginner and professional programmers, and it provides an essential resource for serious REAL-basic programmers.

A P P E N D I X C ■ W H A T ’ S N EX T ? 355

Figure C-1. REALbasic Developer magazine provides access to REALbasic articles and advertisements sponsored by third-party developers.

356 A P P E N D I X C ■ W H A T ’ S N E X T ?

Joining REALbasic Mailing ListsYou can find a Mailing Lists link to REALbasic mailing lists located on the support page at the REALbasic website (www.realbasic.com/support/). Go to this URL and you’ll be given the opportunity to sign up with any of the following mailing lists.

• Getting Started. A mailing list dedicated to the needs of beginning REALbasic programmers.

• REALbasic NUG. A mailing list where experienced REALbasic programmers post ques-tions and share answers.

• REAL News. A mailing list where you can sign up to receive REALbasic announcements.

• Tips. A mailing list that provides access to useful information and tips provided by Geoff Perlman, CEO of REAL Software.

• REALbasic Games. A mailing list dedicated to discussions and questions related to game development using REALbasic.

• Plugins. A mailing list where you can get information about REALbasic plug-ins.

To sign up with one or more of these mailing lists, all you need to do is provide your e-mail address, and then specify whether you want to receive individual mailing-list postings or mes-sages in digest format before you click the Submit Request button.

357

Index

■Symbols#If … #EndIf block, 164, 171–172

& (ampersand) character, 123

+ (plus) button, 287

+ (plus) character, 158

< operator, 173

<= operator, 173

<> operator, 173

= (equals) operator, 173

> operator, 173

>= operator, 173

■AAbout window, Help menu, 235

accelerator keys, menus, 105, 118, 121, 123

AcctStatus column, 289

Action event handler, 268, 271, 298, 309, 320, 341

Action events, 29–30, 32, 50, 63, 101, 184

ActionButton, 217

ActionButtonCaptain property, 248

ActiveX controls (Microsoft), 95–96

Add Bookmark menu, Main toolbar, 38

Add Constant button, 235, 263

Add Menu Event Handler button, 157

Add Menu Handler button, 132, 185, 204, 220, 237, 320

Add Method button, 235, 340

Add Module button, 221

Add Property button, 137, 263, 319

Add Window button, 68, 225, 234

Add Window icon, 47

adding new controls, 95

AddRow method, ListBox control, 188, 190

Advanced button, 288, 296

aligning controls, 96–97

alignment tools, 96–97

Alt key, 123

AlternateActionButton, 217

Alternate-MenuModifier property, 121

ampersand (&) character, 123

Analysis, EditField control, 183

And operator, 175

App class object, 263

App item, 22, 75, 177, 293

Append method, 149, 196

AppendToTextFile method, 252

Apple menu, 37, 128

Apple QuickTime, 86, 203

Apple WebKit, 58

AppleMenuItem value, 128

Apples XCode vs. REALbasic, 16

application data overview, 135

application development cycle, 19

Application menu, Mac OS X, 128

application windows, 78

ArrayName, 147

arrays, 146

changing size, 148–149

defined, 138

dimensions, 147

loading data, 147

multidimensional, 147

retrieving data, 148

audio

NotePlayer control, 301, 305–309

Sound class, 301–304

358 ■I N D E X

audio (continued)

sound effects, 301

speak method, 301, 304–305

AutoEnable property, 126

■BBack button, Windows Editor toolbar, 98

BackColor property, 310

BackDrop property, 313

Backward button, Windows Editor toolbar, 98

Backward menu, Main toolbar, 38

BASIC programming language, 3–4

bbBold PushButton control, 271

bbFontSize control, 270

beep method (sound effect), 301–302

BevelButton control, 79, 260, 268–272

bitmap file, 232

blnExitApp variables, 165

Bold property, 27

book database application, 292

Bookmarks menu, 37

Boolean constants, 171

Boolean expression, 198

Boolean value, 140, 228

Break keyword, 330

breakpoints, 329–330

Browse button, 283

Browser pane, 220

Browser windows, 219

bugs, 323

Build icon, 32

Build menu, Main toolbar, 38

Build Process icon, 325–326

Build Settings option, 32

built-in constants, 151

built-in database support, REALbasic 2006 standard edition, 11

built-in source code, 211

■Ccalculator application, 154, 156–161

Cancel button, Open dialog window, 251

CancelButton, MessageDialog, 217

CancelButton, MessageDialogButton, 217

CancelButtonCaption property, 248

Canvas control, 80, 84, 301, 310, 313, 317, 349

cAppName constant, 153

Caption property, 28, 62, 140–142, 269

Case Else statement, 170

Case statement, 169

Catch blocks, 337

CDbl data type conversion, 145

CDbl function, 145

changing properties, 61

CheckBox control, 78, 80, 320

Checked property, 204, 206

Child method, FolderItem class, 246

Clear button, 158

Clear method, 151

Clone method, Sound class, 302

CloseButton control, 100

CMY color model, 312

code blocks, 143, 164–165

Code Editor, 11, 29–30, 42, 49, 101, 136, 157, 181, 203, 219–220, 226, 235, 293, 327

Code Editor pane, 330

Code Editor toolbar, 220

Code view, 131

Color Picker window, 310

Column List field, 286

Column method, DatabaseRecord class, 283

ColumnCount property, 289

ComboBox control, 81, 191, 199

Comment Command button, 136

comments, 135–136, 138

Commit method, Database class, 283

common prefix characters, 143

359■I N D E X

Find it faster at http://superindex.apress.com

Common UNIX Printing System (CUPS), 10

comparison operators, 173

compiling applications, 4, 32–33

conditional logic, 163, 348

#If … #EndIf block, 171–172

If … Then … Else block, 166, 168

If … Then … ElseIf block, 168–169

If … Then statement, 164–165

multiple line If … Then blocks, 165

OS specific conditions, 171–172

overview, 163–164

Select … Case block, 169, 171

single line If … Then statement, 165

types of conditional statements, 163

Config.txt, 246

Connect method, REALSQLDatabase class, 277

console application, 13, 44, 292

CONST keyword, 152

Const statement, 152

Constant Name field, 235

constants, 138, 153

locally defined, 152

modules, 224

windows, 226, 233, 235

Container control, 80

contextual menu, Code Editor, 198

ContextualMenu control, 81

control objects, 209

control subclasses, 212

controlling statement execution, 332

controls, 23

adding, 78, 95

alignment, 96–97

BevelButton, 79

built-in, 47

Canvas, 80

CheckBox, 80

ComboBox, 81

Container, 80

ContextualMenu, 81

DatabaseQuery, 81

DataControl, 82

deleting, 79

DisclosureTriangle, 82

EditField, 82

ExcelApplication, 83

Favorite controls, 47

GroupBox, 83

HTMLViewer, 84

ImageWell, 84

Line, 85

ListBox, 85

lost controls, 78

MoviePlayer, 86

NotePlayer, 86

OLEContainer, 86

Oval, 87

PagePanel, 87

Placard, 88

Plug-in controls, 47

PopupArrow, 88

PopupMenu, 88

PowerPointApplication, 89

ProgressBar, 89

ProgressWheel, 89

Project controls, 47

properties, 78

PushButton, 90

RadioButton, 90

Rb3Dspace, 90

RbScript, 90

Rectangle, 90

RoundRectangle, 91

ScrollBar, 91

Separator, 91

Find it faster at http://superindex.apress.com

360 ■I N D E X

controls (continued)

Serial, 92

ServerSocket, 92

Slider, 92

SpotlightQuery, 92

SpriteSurface, 92

StandardToolbarItem, 93

StaticText, 93

tab order, 97

TabPanel, 93

TabSocket, 93

Thread, 94

Timer, 94, 99

ToolbarItem, 94

UDPSocket, 94

UpDownArrows, 94

WordApplication, 94

Controls pane, 47, 77

Conversion Utility for Visual Basic projects, 349–350

coordinate system, graphics, 310

Count property, 150, 247

Counter variable, 193

CreateDatabaseFile method, 276, 281–283

CreateTextFile method, 252

cross-platform remote debugging, 13

cryptic errors, 333

CStr data type conversion, 145

CStr function, 145

cTitlebarMsg constant, 263

CUPS (Common UNIX Printing System), 10

custom control classes, 212, 215

custom project templates, 44

custom properties and methods, 339, 341

Customize Main Toolbar dialog, 38–39

■Ddata, 138

arrays, 146–149

constants, 151–153

data type conversion, 144

dictionaries, 149–150

key-value pairs (dictionaries), 149–150

REALbasic data types, 139–140

scope of variables, 144

storing and retrieving overview, 138

string manipulation, 145–146

variables, 142

data type conversion, 144

data types, 139–140, 348

Database Editor, 283, 285, 287–288

Database property, REALSQLDatabase class, 277, 291

DatabaseFile property, REALSQLDatabase class, 276

DatabaseQuery control, 81, 289–291

DatabaseRecord class, 283

databases

Add Database (REALbasic IDE), 275

adding tables, columns and indexes (REALbasic IDE), 278–279

changing data (IDE), 288

Connect method, 277

connecting to a database (REALbasic IDE), 276

CreateDatabaseFile method, 276, 281–283

creating REAL SQL databases, 275

Database Editor, 283, 285, 287–288

DatabaseQuery control, 289–290

DataControl control, 291–292

defined, 273

front-end programs, 289

indexes, 280–281

opening REAL SQL databases, 275

plug-ins, 274

queries, 283, 285, 287

schemas, 277

SELECT keyword, 287–288

SQLExecute method, 281–283

361■I N D E X

Find it faster at http://superindex.apress.com

Structured Query Language (SQL), 274, 287–288

DataControl control, 82, 289, 291–292

DataField property, 291–292, 350

DataSource property, 291–292, 350

DataType keyword, 193–194

Date class, 215

DebugBuild constant, 151, 171

DebugBuild OS specific condition, 171

debugger operation, 328

debugger toolbar, 333

debugging, 8

breakpoints, 329

controlling statement execution, 332

debugger operation, 328

error categories, 323

error handler code, 333–337

error prevention, 324

exception blocks, 334–337

listing syntax errors, 326

logical errors, 328

run-time errors, 327–328, 334

Stack list, 330

stepping program execution, 333

syntax errors, 324–325

toolbar, 333

tracking values, 330, 332

trapping errors, 333–337

Try - Catch blocks, 337

Variables pane, 330, 332

DecimalButton control, 158

Decrypt window, 77

default window, 47, 75

Delete method, FolderItem class, 250

deleting

files or folders, 250

windows, 76

deleting controls, 79

demo application, 293

demo REALbasic version, 12

design conventions, menus, 122

desktop calculator, 154

desktop clock application, 98–101

development platform, 8

dictionaries, 138, 149–150

Dim keyword, 147, 150

Dim statement, 142–143

dimensions, 147

dimensions of arrays, 147

disabling menu items, 126

DisclosureTriangle control, 82

Display Name, 245

DisplayMsg subroutine, 229

DLL "hell" and REALbasic, 15

Do … Loop, 188–189

Do … Until Loop, 189–191

Document window, 69, 87

documentation, 52–53, 56

Do ... Loop loop, 188

dot notation, 140

downloading REALbasic, 13

DownTo keyword, 194

DrawBlock method, 258, 266–267

Drawer Window, 75

DrawLine method, 316

DrawStopIcon method, 315

DrawString method, 257–258, 314–315

dynamic arrays, 148–149

■EedfTextArea control, 265, 270

Edit Bookmarks dialog, 40

Edit menu, 37, 107–108, 179, 233

Edit Value window, 27

EditField control, 24, 27, 60, 63, 81–82, 99, 130, 143, 158, 177, 183, 185, 192, 196, 252, 258, 260, 269–270, 287, 296, 298–299

Editor Only menu item, 42

362 ■I N D E X

Editor toolbar, 42, 45

editors, 42

Element variable, 195

elements, 146

Else statement, 166

embedding comments, 135

EnableMenuItems event handler, edfTextArea control, 265

Encrypt window dialog, 76

encrypting and decrypting windows, 76–77

endless loops, 199

EndOfLine class, 215

EndOfLine object, 193, 216

enhanced database support, REALbasic 2006 professional edition, 12

equals (=) operator, 173

error categories, 323

error handler code, 333–337

ErrorParameter parameter, 334

ErrorType parameter, 334

event code, 62–63

event handlers, 219–220

Event Handlers entry, 293

event programming, 29–30

event-driven programming, 218–220

events, 50

ExcelApplication control, 83

exception blocks, 334–337

execution platform, 8, 10

Exists method, 249

Exit option, 119

Exit statement, 189

Explanation, MessageDialog, 217

Export option, 212

exporting control classes, 212

extensibility, REALbasic 2006 standard edition, 12

extension file identifier, 244–245

Extensions property, 204, 245

■Ffile and folder processing

Child method, 246

Count property, 247

deleting files or folders, 250

FolderItems, 245

GetOpenFolderItem, 245, 247–248

location, 246

OpenDialog class, 247–248

overview, 243

special folders, 247

verifying file or folder existence, 249

File menu, 37, 107, 262

file system access, 348

file type, 243

File Type Set, 244–245, 262

File Type Set Editor, 245, 262

FileClear menu, 131

FileOpen menu, 204

FileOpen menu handler, 264

FileOpen menu item, 237

FileOpenMP3File menu item, 320

FilePlay menu, 205

FilePrint menu handler, 266

FileQuit menu handler, 267

FileQuit menu item, 131

FileSave menu handler, 264

FileStop menu item, 206

FileType class, 204

FillRect method, Graphics class, 316

Filter property, 248

Floating Window, 70

focus, controls, 97

FolderItem class, 205, 247, 252, 303, 310

FolderItem objects, 276

FolderItem reference, 246, 250

FolderItems, 245

folders. See file and folder processing

font changes, styled text, 252–253

363■I N D E X

Find it faster at http://superindex.apress.com

Font section, 27

For … Each loop, 188, 195, 197

For … Next loop, 148, 188, 193–195

ForeColor property, Graphics class, 314

Forward button, Windows Editor toolbar, 98

Forward menu, Main toolbar, 38

Frame property, 68, 225

Front button, Windows Editor toolbar, 98

front-end database programs, 289

functions, 227–228, 348

■GGetFolderItem method, 246, 277, 303

GetNetworkInfo method, 340–341

GetNetworkInterface method, 338

GetOpenFolderItem function, 205, 245, 247–248, 251, 264, 304

GetRandomNumber function, 230

GetSaveFolderItem function, 254–255, 264

global bookmark, 39

Global Floating Window, 73

Global level, 222

global module scope, 222

graphic file types supported, 231

graphical integrated development environment (IDE), 4

graphics

Canvas control, 313

CMY color model, 312

coordinate system, 310

Graphics class, 313–316

HSV color model, 312

icons, 314–315

lines, drawing, 315

Paint event, 313

Pixel property, 313

RGB color model, 312

shapes, drawing, 316

Windows backgrounds, 310, 313

Graphics class, 301, 310, 313–316

Graphics object, 256–258

GroupBox control, 83, 90, 166–167, 177

GUI programming, 22–23

■Hhardware requirements

Linux, 10

Macintosh, 8

Windows, 9

HasBackColor property, 310

Hello World first application, 19–20, 23, 26

Help menu, 37, 52–53, 56, 157

help system, REALbasic 2006 standard edition, 11

HelpAbout menu item, 132, 206

HelpOnlineSupport menu item, 237

higher-level scope, 180

History menu, 37

horizontal alignment indicators, 96–97

HSV color model, 312

HTMLViewer component, 57–59, 61–64

HTMLViewer control, 59, 84

HTMLViewer1 control, 62

■Iicon file association, 245

Icon property, 177, 201

icons, drawing with Graphics class, 314–315

IDE (Integrated Development Environment), 4–5, 7, 20, 35–36, 67, 103, 273, 325

If … Then … Else block, 166, 168, 276

If … Then … ElseIf block, 168–169

If … Then statement, 164–165

ImageWell control, 84, 232

importing

control classes, 212

Visual Basic projects, 349

indexes, 147, 280–281

infinite loops, 199

InitialDirectory property, 248

InRange method, Random class, 182

364 ■I N D E X

Insert method, arrays, 149

instance, controls, 24

instantiation, 209

InStr string manipulation function, 145

Instrument property, 306

intCounter variable, 188, 190, 197, 199

IntegerColumn method, DatabaseRecord class, 283

integers, 140

Integrated Development Environment (IDE), 5, 7, 20, 35–36, 67, 103, 273, 325

Intel Macintosh, 9

Interface Assistant displays, 96

interface scrolling, 94

InterfaceID property, 340

internet development features

REALbasic 2006 professional edition, 12

REALbasic 2006 standard edition, 11

Interrupt parameter, 304

intResult variable, 159

intSecretNumber property, 182, 185

IsPlaying method, Sound class, 302

iterative processing overview, 187–188

■KKey property, 120–121

keyboard equivalents, 118

keywords, 348

■Llanguage reference, 54

lbxInterfaceIDs ListBox control, 341

Left property, 248

Len string manipulation function, 145

Line control, 85, 261

Line Separator bars, 262

line-by-line control, 330

lines, drawing with Graphics class, 315–316

Linux, 10

hardware requirements, 10

OS compatibility, 10

user interface design, 68

ListBox control, 85, 212, 289

listing syntax errors, 326

Load caption, 63

LoadURL method, 62

local bookmark, 39

Location area, 56

Location menu, Main toolbar, 38

log file, 163

logical errors, 328

logical operators, 169, 175

LongTime property, Data object, 101

loops, 148, 348

For … Each loop, 195, 197

For … Next loop, 193–195

Do … Loop, 188–189

Do … Until Loop, 189–191

endless, 199

overview, 187–188

shortcuts for creating, 197–198

While … Wend loop, 192–193

lost controls, 78

Lowercase string manipulation function, 145

Ltrim string manipulation function, 145

■MMacControlKey property, 121

MacCreator file type, 245

Macintosh, 10

applications, 119

hardware requirements, 8

user interface design, 68

Macintosh Classic, 128

Macintosh menu customizing, 128

Macintosh-only modifier keys, 121

MacOptionKey property, 121

MacType, 245

MacType file type, 245

main toolbar

Add Bookmark, 38

365■I N D E X

Find it faster at http://superindex.apress.com

Backward, 38

Build, 38

configuration, 38–39

Forward, 38

Location, 38

Run, 38

Search, 38

Mandatory key, 279

mathematical operators, 173–174

MaximizeButton, 61

MediaPlayer, Windows, 86, 203

Menu Editor, 42, 47, 49, 103, 117

Menu Event Handler button, 131

menu handlers, 124, 220, 233

menu headings, 122

menu items, 103, 105

menu system, 103, 179

MenuBar control, 99

MenuBar Editor, 130–131, 157, 179, 202, 233

MenuBar items, 104

MenuBar1 item, 22

MenuHandlerName placeholder, 126

MenuItem Name drop-down list, 204, 237

MenuItem Name field, 132, 157, 263

MenuModifier property, 120–121

menus, 105

accelerator keys, 118, 121, 123

adding a new menu bar, 108–109

Apple and Macintosh menu customizing, 128

autoenable, 126

Bookmarks menu, 37

converting menu items to menus, 127

disabling menu items, 126

Edit menu, 37

example word processor application, 263–268

File menu, 37

Help menu, 37

History menu, 37

keyboard equivalents, 118

menu components, 105–106

menu items, 112, 114

Menubar default, 106–107

overview, 103–104

previewing menus, 117

Project menu, 37

reconfiguring menu organization, 126–127

removing menu and menu items, 128

separator bars, 119

shortcuts, 118, 120–121

submenus, 37, 109, 112, 115–116

triggering commands, 123, 125

View menu, 37

Window menu, 37

Message, MessageDialog, 217

MessageDialog class, 76, 216–218, 231, 263, 267–268

MessageDialog object, 217

MessageDialogButton class, 217

Metal window, 74

Method Name field, 235

methods

modules, 222–223

parameters, 227–228

windows, 226, 228, 230, 235

Microsoft ActiveX controls, 95–96

Microsoft Office, 83, 89, 94

Mid function, 145

Mid string manipulation function, 145

MIDI, 305

migrating from Visual Basic

Conversion Utility, 349–350

differences, 348–349

importing Visual Basic projects, 349

overview, 347

preparation, 349

Mile, 95

MinimizeButton control, 100

366 ■I N D E X

Modal Window, 70

module scope, 222

modules, 220–222

Monkeybread plug-in controls, 95

Mouse Move drag event, 184

MouseMove event handler, 228

Movable Modal Window, 69–70

movie player application, 200, 202–204, 206–207

MoviePlayer control, 86, 200–201, 205, 301

Mozilla browser, 58

MP3 Player application, 317, 319–321

MPEG video files, 200, 202–204, 206–207

MsgBox function, 76, 133, 157, 165, 197, 216

multidimensional arrays, 147

multiline input, 82

Multiline property, EditField control, 253, 304

multiplatform application creation, REALbasic 2006 professional edition, 12

multiple line If … Then blocks, 165

multiple operating systems (OSs), 117

MyTestDB database, 291

■NName property, 156, 204, 221, 225

Network Connection Checker, 338

network connection checker application, 338–343

NetworkInterface object, 338–339

NetworkInterfaceCount property, 338

New keyword, 150, 182

New Project dialog, 43

NewChanges property, 265

NextPage method, Graphic class, 257

Not operator, 175

NotePlayer class, 307

NotePlayer control, 86, 301, 305–309

notes, 136

null array, 148

number guessing application, 176, 178–179, 181, 183–184, 186

numeric data types, 140

■Oobject binding, 289

Object class, 210

ObjectName, 140

object-oriented programming (OOP), 6, 209

advantages, 210

classes, 209, 215–216

control objects, 209, 211–212

events, 218–220

instantiation, 209, 211, 215–216

menu handlers, 220, 233

modules, 220–222

noncontrol classes, 209–210

overview, 209

REALbasic 2006 standard edition, 11

windows, 225–226

OLEContainer control, 86

Online Support web page, 234

OOP. See object-oriented programming

Open dialog, 177, 205

Open dialog window, 245, 247–248, 264

Open event, 181, 203

Open event handler, 237, 269–270, 313, 335

Open file dialog window, 245

Open menu item, 218

Open subroutine, 227

OpenAsSound method, 303

OpenAsTextFile method, 251

OpenDialog class, 247–248, 254

OpenImage method, 236

OpenPrinter function, 258

OpenPrinterDialog function, 256, 267

OpenStyledEditField method, 253, 264

OpenStyledEditField method, FolderItem class, 253

operator precedence, 174

367■I N D E X

Find it faster at http://superindex.apress.com

operators, 348

Optional keyword, 231

Options menu item, 325–326

Options window, 325

OptionsMediaPlayer menu item, 206

OptionsQuickTime menu item, 204, 206

Or operator, 175

OS compatibility, Linux, 10

OS specific conditions, 171–172

OutOfBoundsException error, 336, 341

OutOfMemoryException run-time error, 327

Oval control, 87

■PPage Setup dialog, 255–258, 267

Page Setup settings, 263

PagePanel control, 87

Paint event, 313

Pan method, Sound class, 302

parameter line, 227

parameters

default values, 230

methods, 227–228

Parameters field, 230

Parent property, FolderItem class, 246

Pause button, Debugger toolbar, 333

pbnAdd PushButton, 299

pbnMute control, 320

pbnPlay control, 320

pbnStop control, 320

PCAltKey property, 121

PersonalBookDB database, 292

PersonalBookDB item, 299

picture viewer application, 231, 233–238

pitch integer, 307

pixel, 85

Pixel property, 313

Placard control, 88

Plain Box Window, 71

platform-specific application creation, REALbasic 2006 standard edition, 12

Play method

MoviePlayer control, 206

Sound class, 302–303, 320

PlayerType property, MoviePlayer control, 206

PlayLooping method, Sound class, 302, 320

PlayNote method, 307

plug-ins, 95, 274

plus (+) button, 287

plus (+) character, 158

PopupArrow control, 88

PopupMenu control, 81, 88, 191

porting, 9

PowerPointApplication control, 89

prebuilt program code, 209

predefined constants, 226

predefined properties, 226

Preferred player, 203

PrefsMenuItem value, 128

preventing programming errors, 324

Primary key, 279

Print dialog, 255–258

PrinterSetup object, 266–267

printing

files, 255–258

styled text, 258

PrintSettings object, 267

Professional version features, 12–13

Professional versus Standard REALbasic, 10

program code, 29, 187

ProgressBar control, 89, 194, 209

ProgressWheel control, 89

Project Controls option, 214

Project Editor, 42–45, 76, 201, 212, 221, 232, 244, 277, 283

Project menu, 37

Project screen, 221, 225, 234, 275

Project tab, 32, 64

368 ■I N D E X

Project Templates folder, 44

projects, 5

Projects screen, 99

PromptText property, 248

properties, 61, 140

assigning values, 140–141

controls, 26–28, 78

Me keyword, 141

modules, 222

overview, 140

retrieving values, 141–142

Self keyword, 141

windows, 226

Properties pane, 26, 46, 61, 78, 221, 225

property comments, 137

Property Sheet, 214

PropertyName, 140, 142

Protected level, 222

protected module scope, 222

prototyping, 6

Public level, 222

public module scope, 222

public-level scope, 180

PushButton control, 6, 23, 28–29, 50, 60, 62–63, 87, 90, 99–100, 112, 141, 154, 157–158, , 163, 166, 177, 184, 196, 210, 218–219, 225, 261, 268, 309, 318

■Qqueries, 283, 285, 287

Query button, 284, 296

QuickTime, 86, 203–204, 305

Quit option, 119

■RRAD (rapid application development), 6

RadioButton control, 78, 83, 90, 166–167

Random class, 176

random numbers, 230

Random object, 182, 185

rapid application development (RAD), 6

rapid release online distribution model, 8

RB Book Database application, 292

RB Movie Player application, 200, 202–204, 206–207, 301

RB MP3 Player application, 317, 319–321

RB Number Guess application, 176, 178–179, 181, 183–184, 186

RB Picture Viewer application, 231, 233–238

RB Word Processor, 258, 262

RB Word Processor application, 172, 259–260, 262–272, 294–296, 298–299

Rb3Dspace control, 90

RBBookFinder Browser application, 57–59, 61–64

RBCalculator application, 140, 154, 156–161

RBClock application, 98–101

RBClock desktop clock application, 98

RBQuickNote application, 129–133

RbScript control, 90

RBVersion constant, 151, 171

ReadAll method, TextInputStream method, 251

reading text files, 250–251

ReadLine method,TextInputStream, 250–251

ReadOnly property, 27, 100

REAL Software website, 18

REALbasic

advantages, 5

versus Apples XCode, 16

compiling, 32–33

cross-platform compatibility, 6

data types, 139–140

defined, 3

demo version, 12

development/execution platform, 8

documentation, 52–53, 56

download distribution, 13

executable files, 32–33

Intel Macintosh, 9

language reference, 54

369■I N D E X

Find it faster at http://superindex.apress.com

Linux, 10

Macintosh, 8

major components, 4

migrating from Visual Basic, 347

multiple projects, 7

operators, 173–175

Professional version features, 12–13

purchasing, 13

REALbasic, 7

remote debugging, 8

reserved keywords, 154

software keys, 14

SQLite database, 8

stand-alone applications, 4

Standard version features, 11–12

Standard versus Professional version, 10

support services, 17, 19

testing an application, 30

timeline, 5

upgrade schedule, 8

vs. Visual Basic, 9, 14–15, 348–349

Windows, 9

REALbasic Feedback, 53

REALbasic plug-ins folder, 95

REALbasic Plugins Web ring, 95

REALbasic project, 212

REALSQLDatabase class, 275

REALSQLDatabase object, 276

Rectangle control, 90

RectControl class, 209

Redim statement, arrays, 148

reduced code maintenance, 211

RefreshDisplay( ) method, 340–341

REM keyword, 135

remote debugging, 8

Remove method, arrays, 149

removing menu and menu items, 128

Replace string manipulation function, 145–146

Resizable property, 61

Resume button, Debugger toolbar, 333

RGB color model, 312

Rounded Window, 72

RoundRectangle control, 91

royalty-free deployment, 12

Rtrim function, 145

Rtrim string manipulation function, 145

Run Event Handler, 294

Run icon, 26, 60, 63

Run menu, Main toolbar, 38

Run screen, 330

RunQuery method, DatabaseQuery control, 289

run-time errors, 327–328, 334

■SSampleReport.doc, 244

sampling, 348

SaveAsDialog class, 254–255

SaveStyledEditField method, 253, 264

schemas, 277

scope of variables, 143–144

screen area components, 41

screens, 42

ScrollBar control, 91

Search menu, Main toolbar, 38

securing source code, 76–77

SelChange event handler, EditField control, 269

Select … Case block, 169, 171

SELECT keyword, 287–288

Select … Case statement, 164

SelectFolder function, 249

SelectFolderDialog class, 249, 254

Self keyword, 141

SelTextFont property, EditField control, 253

SelTextSize property, EditField control, 253

separator bars, 105, 118–119

Separator control, 91

370 ■I N D E X

Serial control, 92

ServerSocket control, 92–93

Shadowed Box Window, 72

Sheet Window, 73

shortcuts

for creating loops, 197–198

menus, 118, 120–121

Show Control Order button, Windows Editor toolbar, 98

Show method, windows, 226

ShowModal, MessageDialog, 218

ShowModalWithin, MessageDialog, 218

SimpleText application, 243

single dimensional array, 147

single line If … Then statement, 165

single-line input, 82

Slider control, 92, 176–177, 182–184, 318

smaller applications, 211

software keys for REALbasic development system, 14

Sort Data window, 286

Sort Order field, 286

Sound class, 301–304, 319

sound effects, 301

SoundFile object, 320

source code, 238

Speak method, 301, 304

speak method, audio, 301, 304–305

special folders, 247

SpecialFolder object, 247

SpotlightQuery control, 92

sprite, 92

SpriteSurface control, 92

SQL (Structured Query Language), 274, 287–288

SQLExecute method, 281–283

SQLite database, 8

SQLQuery property, 289

Stack list, debugging, 330

stand-alone applications, 4

Standard version features, 11–12

Standard versus Professional REALbasic, 10

StandardToolbarItem control, 93

starting REALbasic, 35

statement parameters, 324

statements, 164, 188

StatesListBox class, 214

StaticText control, 24, 27, 62, 77, 93, 177, 296, 298, 308, 318

Step button, Debugger toolbar, 333

Step In button, Debugger toolbar, 333

Step keyword, 195

Step Out button, Debugger toolbar, 333

Step value, 194

stepping program execution, 333

stickypad application, 129–133

Stop button, Debugger toolbar, 333

Stop method

MoviePlayer control, 206

Sound class, 302

Str data type conversion, 145

Str function, 145

strCustomerArray array, 335

strCustomerName variables, 170

string comparisons, 173

string manipulation, 145–146

strMessage variable, 197

strNamesDictionary object, 150

strPrintSettings variable, 256

strSampleMsg variable name, 146

Structured Query Language (SQL), 274, 287–288

strUserName, 165

strWishListArray property, 196

Styled property, EditField control, 252–253

styled text, 243, 252–253, 258

StyledTextPrinter class, 258, 266

subcategories, 55

371■I N D E X

Find it faster at http://superindex.apress.com

subclasses, 210

submenus, 105, 109, 112, 115–116

subroutine, 183, 227

subroutines, 227–228

Super Class, 211, 220

Super property, 128

support for REALbasic, 17, 19

Support page, REAL Software website, 18

SupportWindow, 225

syntax errors, 324–326

System object, 338

■Ttab order for controls, 97

TableName property, 291

TabPanel control, 93

Tabs bar, 41

TabSocket control, 93

TargetBigEndian OS specific condition, 171

TargetCarbon OS specific condition, 172

TargetFile, 246

TargetHasGUI OS specific condition, 171

TargetLinux OS specific condition, 172

TargetLittleEndian OS specific condition, 172

TargetMachO OS specific condition, 172

TargetMacOS OS specific condition, 172

TargetMacOSClassic OS specific condition, 172

TargetWin32 OS specific condition, 172

TCPSocket control, 77

Terminal window, 296

text file processing

file type set, 244–245

GetSaveFolderItem function, 254–255

Graphics object, 256–258

OpenStyledEditField method, 253

overview, 243

printing files, 255–258

printing styled text, 258

reading files, 250–251

SaveAsDialog class, 254–255

SaveStyledEditField method, 253

styled text, 252–253, 258

writing files, 252

Text properties, 157

Text property, 27, 123

TextAlign property, 28

TextColor property, 27

TextFont property, 269

TextInputStream, 250–251

TextOutputStream object, 252

TextPhrase placeholder, 304

TextSize property, 100, 269

TextTypes variable, 204

TextWindow variable, 264

Then keyword, 165

Thread control, 94

Timer control, 77, 94, 99

Tips bar, 51–52

Title, MessageDialog, 217

Title property, 26, 233, 248, 308

ToolbarItem control, 94

toolbars, 38–39

Top property, 248

trapping errors, 333–337

trigger command, 114

triggering commands with menus, 123, 125

Trim function, 145

Trim string manipulation function, 145

Try - Catch blocks, 337

Try block, 337

Try keyword, 337

TypeMismatchException run-time error, 327

■UUbound function, 148

UDPSocket control, 94

Until keyword, 189

Update Database records window, 288

372 ■I N D E X

UpDownArrows control, 94

Uppercase function, 145–146

URLSite window, 237

user interface

design, 59–60, 67–70, 72, 75–76

windows, 67–70, 72, 75–76

■VVal data type conversion, 145

Val function, 145

Value keyword, 193

Value property, 194

ValueChanged event handler, 321

Van Hoek Software, 95

Varchar data type, 282

variable declaration, 348

variables, 180

defined, 138

naming, 143, 348

syntax rules, 142

Variables pane, debugging, 330, 332

velocity integer, 307

verifying file or folder existence, 249

vertical alignment indicators, 96–97

View As drop-down list, 39

View menu, 37

visible and invisible controls, 77

Visual Basic background, 80

Visual Basic Project Conversion utility, 349

Visual Basic vs. REALbasic, 9, 14–15

Volume function, 246

Volume method, Sound class, 302

Volume property, 321

■Wweb browser application, 57–59, 61–64

web server development enhancements, 12

While … Wend loop, 188, 192–193

Window Code editor, 319

Window Editor, 11, 45, 47, 59, 157

Window Layout view, 181

Window menu, 37

windows, 10

adding, 68, 225

backgrounds, 310, 313

constants, 226, 233, 235

displaying, 225

methods, 226, 228, 230, 235

overview, 225

properties, 226

REALbasic choices, 68

user interface design, 68

Windows Editor, 42, 97, 99, 181

Windows Layout view, 203

Windows Media Player, 86, 203–204

Windows operating system, hardware requirements, 9

Windows property, EndOfLine class, 216

Windows1 item, 22

WindowsAppName property, 64

word processor application, 259–260, 262–272, 294–296, 298–299

WordApplication control, 94

WriteLine method, TextOutputStream object, 252

writing text files, 252

■YYear property, 216