
Beginning REALbasic - From Novice To Professional (2006)
.pdf368■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
■Q
queries, 283, 285, 287
Query button, 284, 296
QuickTime, 86, 203–204, 305
Quit option, 119
■R
RAD (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

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
■I N D E X 369
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 |
Find |
|
control, 289 |
||
|
||
run-time errors, 327–328, 334 |
it |
|
|
||
■S |
faster |
|
|
||
SampleReport.doc, 244 |
at |
|
|
||
sampling, 348 |
com.apress.http://superindex |
|
|
||
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

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
■T
tab 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
■I N D E X 371
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 |
it Find |
|
TextTypes variable, 204 |
||
TextWindow variable, 264 |
||
Then keyword, 165 |
faster |
|
|
||
Thread control, 94 |
at |
|
Timer control, 77, 94, 99 |
||
com.apress.http://superindex |
||
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 |
|
■U
Ubound 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
■V
Val 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
■W
web 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
■Y
Year property, 216

P A R T 4
■ ■ ■
Appendixes

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 REALbasic
Depending on the size and complexity of your Visual Basic projects, the challenge of converting 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 applications. 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.
347
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 conflict 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 replacement. 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 UCase functions.
•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 parameters, 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 independentaccess 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 I C P R O J E C T S T O R E A L B A S I C |
349 |
As you can see from this brief sampling, the differences between Visual Basic and REALbasic 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 Work
You can take a number of simple steps prior to converting your program code that can significantly 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 Projects
REALbasic 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 Utility
In 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 website (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