The Project Window 3
The Project 4
Project Components 5
External and Imported Components 5
Folders 7
Editing Windows 7
The Tools Window 8
Manipulating Controls 9
The Properties Window 10
Adding Functionality 12
Code Editors 13
Editing and Executing Code 14
Maintaining Code 15
How the Three Editors Relate 16
Editing Property Values 16
Initial Values and Subsequent Values 17
Invariant Properties 19
Testing Without Building 20
Shortcuts 21
Lines and Commands 26
Variables and Constants 27
Assignment 27
Datatypes and Declaration of Variables 28
Constants 30
Subroutines 31
Subroutine Declarations 31
Return 33
Calling a Subroutine 33
Calling a procedure 34
Calling a function 35
Flow and Side-Effects 36
Editing Subroutine Declarations 37
Pass By Reference 39
Regulating Flow 41
If and Select 42
While 43
Do 44
For 44
Exit and GoTo 46
Arrays 48
Declaring Arrays 49
Resizing Arrays 49
Multi-dimensional Arrays 51
Array Parameters 51
Recursion 52
Comments 54
Messages and Dot-Notation 58
Object Design Philosophy 60
Encapsulation of Functionality 60
Maintenance of State 61
Summary 63
Classes and Instances 63
Anatomy of a Class 68
An Instance Is Born 71
The Application Class 71
The Default Window Class 71
Control Classes 72
MenuItems 72
Non-control Classes 72
Referring to Instances 73
Maintaining a Name 74
Functions As References 75
Self 77
Referring to Controls 78
Me 79
The Window Global Instance Name 80
The Truth About Controls 82
Control Clones and Control Arrays 84
Control Arrays 85
Creating a Control Array 87
Cloning in Code 87
Being Careful With Instance References 89
Initialization Is Not Instantiation 90
Assignment Is Not Cloning 91
Parameters Pass Pointers 94
Comparison Tests Identity 95
Destruction of Instances 96
New Classes and Inheritance 101
Casting 104
Overriding 107
Class Interfaces 112
Events and New Events 116
The Class Hierarchy 122
Global Members 125
Modules 126
The Application Subclass 128
Further Class Features 129
What's My Window? 129
Constructors and Destructors 130
Overloading 131
Class-Directed Messages 133
Privacy 134
Wrappers 135
Example Classes 135
Array Class 135
Stack Class 138
Booleans 141
Conversion of Booleans 142
Side-Effects 143
Strings 144
Concatenation and Conversion 145
Length, Search, Comparison, and Sort 146
Substrings and Case 150
Extending REALbasic's Abilities 151
Converting Between Encodings 152
Numbers 153
Coercion 153
Bases 155
Operators 155
Trigonometry and Exponentiation 156
Miscellaneous Arithmetic 157
Variants 158
Collections 160
Dates 161
Date Class Properties 161
Date Calculations 162
Colors 164
Memoryblocks 167
Creating a Memoryblock 168
Exchanging Data With a Memoryblock 168
Using Memoryblocks For Speed 170
Being Careful With Memoryblocks 171
Threads 172
Creating and Using a Thread 172
Being Careful With Threads 174
Editing Menus 179
How Menus Are Enabled 182
Menu Item Classes 183
Cloning Menu Items 184
Default Menu Items 184
The Menu-Enabling Moment 186
What It Is 186
What Happens During It 186
How It Is Triggered 187
Menu Item Functionality 188
Menu Events 189
Menu Event Handlers 189
Modifying Default Menu Item Functionality 190
Dynamic Menus 191
Menu Item Arrays 192
Examples of Dynamic Menus 192
Font menu 193
Window menu 194
Three Pillars of Zen 198
Events Make Choices 199
Scope 200
References Are the Thread 201
Parameters 201
Drops 202
Choosing between a parameter and a drop 203
The Application Subclass 206
Order of Events 207
Compile Errors 211
Punctuation Problems 212
Dangling Participles 213
Missing Parameters 214
Define Your Terms 214
Exceptions 216
The Calling Chain 217
Exception Blocks 217
RuntimeException and Its Subclasses 218
Raise 220
Custom RuntimeExceptions 220
The Debugger 223
Breakpoints and Stepping 224
The Debugging Windows 225
Additional Debugging Strategies 226
Building 228
Minor Options 228
Build Type 230
Heap Size and Memory Management 231
Pragmas 234
Windows Build and Conditional Compilation 234
Applet and Dialog Subclasses 240
Window Types 241
Modal, Non-Modal, and Floating Windows 242
The Frame Property 242
Global Floating Windows 244
Opening and Closing, Showing and Hiding 244
Invisible Windows 246
When a New Window is Shown 249
ShowModal 251
Title, Position, and Size 252
Initial Position 254
Events 255
Drawing in a Window 259
Lifetime Events 263
Appearance 265
Position and Dimensions 266
Mouse Movement Events 267
Redrawing 269
Canvas Events, Properties, and Methods 274
Picture Class 275
Properties 276
Getting a Picture 277
Graphics Class 278
Pen-Based Drawing 279
String Drawing 281
Pixels and Pixel Blocks 282
Backdrop Property 283
Imported Image File 283
Imported Resources File 285
Image File at Runtime 285
File Resource at Runtime 286
NewPicture 286
Fun With Graphics Properties 287
Image Transformations 287
Changing a Backdrop 291
Animation 292
Limitations of Graphics Methods 294
Canvas Graphics Property 295
Paint Event 295
Smooth Animation 297
Scrolling 299
Transparency and Icons 302
Speed 304
Interaction With Other Objects 306
Screen Shots 306
Shifting Other Controls 308
Covering Other Controls 310
PushButton 314
BevelButton 315
Placard 318
LittleArrows 319
CheckBox 320
RadioButton and GroupBox 321
DisclosureTriangle 325
StaticText 325
Custom Buttons 327
Colored Right-Aligned RadioButtons 327
Self-Depressing PushButtons 328
Popdown List 329
PictureButton 330
Types of EditField 333
EditField Events, Properties, and Methods 334
Physical Characteristics 334
Focus 336
Selection, Text, Font, and Style 337
Keyboard 340
The Focus 341
Summary of Rules about the Focus 341
Order of Focus-Related Events 343
Controlling the Focus in Code 343
Floating Find Window 344
Validation Field 345
Manipulating Text and Styles 347
Tickertape Field 348
Styled Word-Processor 349
Styled HTML Editor 350
Word-Selection Field 351
Finding Styles 352
Reacting to User Input 354
After the Fact: "Dirty" Document 354
Intercepting Input 355
Code field 355
Live input validation 356
Drawing Styled Text 357
Miscellaneous Tips 360
ListBox Features 361
ListBox Events, Properties, and Methods 363
Contents and Format 363
Selection 365
Hierarchy 366
Headings and Sorting 367
CheckBoxes and Editable Cells 368
Keyboard 369
Focus 369
Basic ListBox Techniques 370
Contents and Formatting 370
Column Display 371
Pictures 372
The Selection 373
Hierarchical ListBoxes 375
One Folder Row 375
Two Folder Rows 377
General Single-Depth Hierarchy 378
General Multiple-Depth Hierarchy--First Try 379
General Multiple-Depth Hierarchy -- Second Try 382
Other ListBox Features 384
ProgressBar 390
Slider 391
Scrollbar 393
Scrolling Canvas 394
Scrolling Non-Wrapping Field 396
Line 402
Shapes 402
Separator 403
ImageWell 404
ChasingArrows 404
PopupArrow 405
PopupMenu 407
Contents and Format 408
Selection 409
Usage 410
Initialization 410
Changing an item's text 411
Independent caption 412
BevelButton 413
Contents and Format 414
Selection 414
Usage 415
ContextualMenu 416
Contents 416
Selection 417
Usage 417
Alternatives 419
Preparation 422
Properties and Events 422
Usage 423
Keyboard Communication 425
Keyboard Object 427
AsyncCommandKey and Its Friends 427
CommandKey and Its Friends 428
AsyncKeyDown 429
UserCancelled 433
Mouse Communication 435
Mouse Movement 436
Mouse Click 436
Polling the Mouse 438
Balloon Help 439
Cursor 440
Getting a Cursor 440
Negotiating the Cursor 441
Overcoming the Watch 443
Animated Cursors 444
Getting a FolderItem 449
GetFolderItem and GetTrueFolderItem 449
Volumes 451
Special Folders 452
User Dialogs 452
Relative FolderItems 454
File Types 455
File Properties 458
File Actions 459
Navigating the Folder Hierarchy 461
Aliases and AppleScripts 463
Arbitrary Data: Binary Streams 464
Getting a BinaryStream Instance 464
Reading and Writing Data 466
Saving and Restoring Preferences 468
Sequential Data: Text Streams 471
Reading 471
Parsing a Mailbox File 472
Writing 474
Find-and-Replace 475
Resources 477
Getting a ResourceFork 477
Referring to Resources 479
Parsing Resources 480
Predefined Data Formats 483
Sounds 483
Pictures 484
Movies 485
Styled Text 485
References to Files 486
Database Files and Classes 489
Database Class 490
DatabaseRecord Class 491
DatabaseCursor and DatabaseCursorField Class 493
Schemas 495
DatabaseQuery Control 497
Other Data Sources 498
Clipboard Class 502
Usage 503
ListBox Copy-and-Paste 503
Show Clipboard 504
Private Scrap 505
Beginning a Drag 508
The DragItem 508
Multiline EditField 510
ListBox 510
Mouse-Down Receivers 511
Receiving a Drop 512
Finder Drop 515
Internal Drag-and-Drop 516
Limitations and Workarounds 519
Ticks and Microseconds 523
Timers 525
Getting a Timer 525
Timer Behavior 525
When Timers Run 526
Timers as Idle Handlers 528
Yielding Time 529
Beep 533
Sound Object 533
MIDI Notes 535
Movie Class 544
MoviePlayer 545
Appearance 546
Action 547
Events 548
Movie Usage and Limitations 549
Making Movies 551
Analyzing Movies 554
Configuring the SpriteSurface 558
Basic Sprite Control 561
Improving the Classes 564
Intelligent Sprite Behavior 568
Responding to Keys 570
Collisions 572
Soundtracks 574
Printer Specifications 577
The Printer Graphics Object 579
Measurement Problems 580
Resolution Problems 581
Printing Text 583
Socket Properties, Methods, and Events 590
Connecting and Disconnecting 590
Receiving Data 591
Sending Data 592
Errors 592
Yielding 592
Client 592
Buffered Read 593
Dictionary Client 594
Buffered Write 601
SMTP client 602
Server 607
Web-Based Time Server 608
Tiny Web Server 610
Multiple Connections 612
Sending Apple Events 616
Anatomy of an Apple Event 616
Building an Apple Event 618
Remote Targets and Send-To-Self 620
Receiving Apple Events 622
Apple Event Scriptability 623
AppleScript Scriptability 624
The Object Model 626
Apple Event Classes, Properties, and Methods 627
Classes 627
Building and Parsing an Apple Event 627
Records and Lists 630
Building an Object Specifier 631
Apple Event Inadequacies 632
AppleScripts 634
XCMDs 638
Shared Libraries 640
Toolbox Stub Libraries 641
Toolbox Call Fundamentals 641
Parsing and Passing Structs 645
Sharpening Pointers and Grasping Handles 649
Direct Toolbox Calls 652
Plug-ins 657
This page prepared
October 1, 2011
by Matt Neuburg, phd = matt at tidbits dot com,
using RubyFrontier.
RubyFrontier is a port, written in the Ruby language,
of the Web-site-creation features of UserLand Frontier.
Works just like Frontier, but written in Ruby!
Download RubyFrontier from
GitHub.