Google
www ResExcellence

Application Makeovers
Desktop Snapshots
iTunes Skins
Mighty Mouse Cursors
Uploads
Boot Images
Dock Poofs
Links List
Photoshop Goodies
Users Forum
Boot Panels
Download Stats
Log-In Panels
REALbasic
Clocks
GUI Software
Mac OS X Mods
Safari Stuff
Desktop Pictures
Icons
Mac OS X Themes
Splash Screens
Homepage
Download a free demo of REALbasic!
Download a free demo of REALbasic!
Recent Articles...
3D
3D Photo Gallery Part 2 (12-06-01)
3D Photo Gallery Part 1 (11-29-01)

Audio
iPod Tricks (Part 3)
iPod Tricks (Part 2)
iPod Tricks (Part 1)
Laugh Track Machine
Audio Player with Reverb
Shepard Melody(11-08-01)
RB Phone Home (10-25-01)
Build a Drum Machine (10-04-01)

General RB
JPEG in PDF
Hey! You got your Checkbox in my Listbox!
Background Applications (5-02-03)
Listbox Auto-Find
iTunes-style Listboxes
Virtual Volumes
Time Tracker
Software Distribution Part 4
Software Distribution Part 3
Software Distribution Part 2
Software Distribution Part 1
Exceptions
Custom Controls (8-2-01)
Living on the Edge (6-21-01)
Tips and Tricks (6-14-01)
Review of REALbasic 3.0 (2-19-01)
Text Clippings Made Easy (5-10-01)

Graphics
Image Spinner
Cropping Graphics (Part 4)
Cropping Graphics (Part 3)
Cropping Graphics (Part 2)
Cropping Graphics (Part 1)
Shimmer Graphics
Lissajous Figures
Simple Screen Capture
Vector Graphics
Kaleidoscope Images
Stegonography
Spirals!
Image Table (11-15-01)
RB Magnifying Lens (10-11-01)
Screen Capture (8-9-01)
Color Picker Tutorial (6-7-01)

Hacks
Ghost Grab
Speedy Mouse Extension(11-01-01)
iTunes Plugins (8-23-01)
iTunes Skinner (7-26-01)

Internet
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic (10-02-01)
Stock Ticker - Part II (9-06-01)
Stock Ticker - Part I (8-30-01)
AIM Mate (8-16-01)

Mac OS X
Using Sheets in REALbasic
Build a Bundle Part 2
Build a Bundle Part 1
Dock Your Passwords
Mac OS X Debugging
REALbasic Mac OS X Icon Tutorial (12-13-01)
Animate Your Dock (5-17-01)
RB and the Command Line (5-3-01)

Novelty
Guessing Game
Calendar Trivia
Tile Mixer
Zip Code Finder
Happy Valentine's Day
Merlin Simulator Part 3 (01-24-02)
Merlin Simulator Part 2 (01-17-02)
Merlin Simulator Part 1 (01-10-02)
Buzzword Machine (10-18-01)
AppleSoft BASIC (9-20-01)

Printing
Print to PDF

Resources
Picture Extractor 2 (5-31-01)
Picture Extractor 1 (5-24-01)

Serial
Caller ID Part 3 (7-12-01)
Caller ID Part 2 (7-5-01)
Caller ID Part 1 (6-28-01)

Speech
Speech Recognition (9-13-01)
Video
Big Brother Video Capture

Newest Dev Tools!

Book Alert !
REALbasic for Dummies
by Erick Tejkowski
$19.99 @ Amazon

Made with REALbasic!

Problems?
Downloads are in StuffIt 5 format (free download).
Tell me about a bad link (Thanks!).
Submission Policy

2-07-02

Debugging in Mac OS X with REALbasic by Erick Tejkowski

This week we'll take a look at a quick and easy hack to help you debug Mac OS X projects that you create with REALbasic. Not a lot of glitz this time, but it is an essential step in your quest for REALbasic "Excellence". (Good tie-in, eh?) Merlin lovers will have to wait another week for the finished project. (I'm still working on it).

Build the Interface

Interface? We don't need no stinkin' interface! Ok, maybe we need a small one. Launch REALbasic, open Window1 and add a PushButton and an EditField control to the window. You're done!

Add the Code

Choose File-New Module. A new module appears in your Project window. A module is global in nature, which is just a fancy way to say that all parts of your REALbasic project can use the calls within it. Once we finish this module, you can drag it from your project and use it in other projects too.

Open the new module and add a method to it (Edit-New Method). Name the Method something you'll remember. This debugging method is going to send data to the Console application, so name it SendToConsole and add msg as string in the parameters field of the Method definition. Press OK.

To this new method add the following code:

dim i as integer

#if TargetCarbon then
Declare Sub DebugStr Lib "CarbonLib" (msg as Pstring) as Integer
i = DebugStr(msg)
#endif

This code gives you access to the Mac API call: "DebugStr". Any text that you give to DebugStr will show up in the Console application. What? You haven't played with the Console yet? Now's the time! It's located here: /Applications/Utilities/Console.app. The Console application is just a GUI front end for the "old-timey" console, where Unix geeks and programmers like to send text for viewing. For RB programmers, it's like adding your own window and editfield without doing a thing. As you test your program, you can follow along with its progression, by littering your code with statements like:

// place this in the PushButton's Action event from earlier
SendToConsole EditField1.text

//put this in an Open event somewhere
SendToConsole("Open event occurred")

//etc...
SendToConsole("Sprite now moving")
SendToConsole("Sprite has stopped")
SendToConsole("Crash doesn't happen here")
SendToConsole("Crash happens here")

As you program executes, these various text messages will appear in the Console application. It's low-tech, but it gives you another way to debug your applications. If you want to be really slick and do it like "the pros" do it, add a new Boolean constant to the module by selecting Edit-New Constant.

02-07-02_debugsontant.jpg (31k)

Then, change the code from earlier to read like this:

dim i as integer

if debugging then
#if TargetCarbon then
Declare Sub DebugStr Lib "CarbonLib" (msg as Pstring) as Integer
i = DebugStr(msg)
#endif
end if

This way you can sprinkle debugging code all over the place and turn it off by redefining the constant as FALSE. This is fun in OS X, but what about Classic? The DebugStr call works with the Classic Mac OS too, but instead of sending your text to the console (which doesn't exist in OS 9), the string gets sent to the debugger (i.e. Macsbug). Since Macsbug is another topic altogether we'll forego the discussion this time. If I hear of enough interest, I'll gladly talk about it in a future tutorial. It's not terribly scary to use, but it is quite a bit different than the console.

Conclusion

No glitz this week, but you will have lots of glory if it helps you track down a nasty bug. You can download this week's project and example application, in case you don't want to create the project by hand. Have fun and see you next week when we'll hopefully wrap up our Merlin project.


2-05-02

REALbasic News by Erick Tejkowski

TIP: CD Playback in OS X There are a few plugins around that allow you to playback CD audio from your REALbasic projects, but none that work in OS X. The good news is that none are required. The MoviePlayer control in REALbasic is perfectly capable of playing CD audio tracks in Mac OS X (only). Of course, you don't get any of the useful track information that a plugin might afford you, but this at least gives some RB users an option if they need this functionality. Mac OS X treats the CD audio tracks as AIF files, so play them in REALbasic just as you would a normal audio file. Cool!

TIP: Shuttle Control For years, professional audio geeks have had a handy knob on their equipment, called a "shuttle". This knob lets them scan through audio or video at high speed so they can look and listen for specific segments in the media where they might want to work. It works much like the fast forward and rewind buttons on your cassette player, but it also allows you to see and hear the data that is zipping by you. REALbasic users may be surprised to know that they have access to just such a control in their own apps! To use it, simply load your favorite movie into a MoviePlayer control. Then, while pressing the Control key on your keyboard, click on the rewind/ffwd buttons of the MoviePlayer's controller. Voila! Instant shuttle control. Neat!

TIP: Temporary Code Space How many times have you needed to do a search and replace, but only from a subsection right in the middle of your code? You can't simply start the replace from the top of the code, because the code that comes after the subsection will also be replaced. A simple solution that you may have overlooked: copy and paste the code you want to alter (or for that matter just "cut" it). Then, create a new method (Cmd-Opt-M) and name "Dummy". Paste your code in this dummy function, tweak it as desired, and put it back in your original method or event. Dummy methods are a good place to work on shorter code segments or even as a place to stick reminder messages or documentation of the code. And, unlike external text editors, they have the ability to parse REALbasic code. Handy!

ACGIs on Mac OS X James Sentman has released a nifty application called acgi dispatcher. This little gem lets you use AppleEvents with the Apache web server. Not only is this application Made With REALbasic, but its also capable of working with your REALbasic cgi's. Fantastic!

REALbasic Folklore Did you know.... At one of REAL Software's first appearances at a MacWorld, their machine for processing credit card numbers unexpectedly stopped working. A few minutes later, REAL Software had whipped up an application (with REALbasic, of course) that read in the numbers from their card scanner via a Serial control. REALbasic saved the day for REALbasic. Wacky, but true!


Application Makeovers
Desktop Snapshots
iTunes Skins
Mighty Mouse Cursors
Uploads
Boot Images
Dock Poofs
Links List
Photoshop Goodies
Users Forum
Boot Panels
Download Stats
Log-In Panels
REALbasic
Clocks
GUI Software
Mac OS X Mods
Safari Stuff
Desktop Pictures
Icons
Mac OS X Themes
Splash Screens
Homepage

Maintained by the Staff of ResExcellence. This entire site ©1997-2003 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.

[an error occurred while processing this directive]on the ResEx LinuxPPC Server