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)
3D Photo Gallery (Part 1)

Audio
iPod Tricks (Part 3)
iPod Tricks (Part 2)
iPod Tricks (Part 1)
Laugh Track Machine
Audio Player with Reverb
Shepard Melody
RB Phone Home
Build a Drum Machine

Custom Controls
Custom Buttons
Custom Buttons Part II
iTunes-style Listboxes
Custom Controls

General RB
Wiggle Window
JPEG in PDF
Hey! You got your Checkbox in my Listbox!
Background Applications
Listbox Auto-Find
Virtual Volumes
Time Tracker
Software Distribution (Part 4)
Software Distribution (Part 3)
Software Distribution (Part 2)
Software Distribution (Part 1)
Exceptions
Living on the Edge
Tips and Tricks
Review of REALbasic 3.0
Text Clippings Made Easy

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
RB Magnifying Lens
Screen Capture
Color Picker Tutorial

Hacks
Ghost Grab
Speedy Mouse Extension
iTunes Plugins
iTunes Skinner

Internet
Display Web Image In Canvas
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic
Stock Ticker (Part 2)
Stock Ticker (Part I)
AIM Mate

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
Animate Your Dock
RB and the Command Line

Novelty
Guessing Game
Calendar Trivia
Tile Mixer
Zip Code Finder
Happy Valentine's Day
Merlin Simulator (Part 3)
Merlin Simulator (Part 2)
Merlin Simulator (Part 1)
Buzzword Machine
AppleSoft BASIC

Printing
Print to PDF

Registration
Registration Code Validation

Resources
Picture Extractor (Part 2)
Picture Extractor (Part 1)

Serial
Caller ID (Part 3)
Caller ID (Part 2)
Caller ID (Part 1)

Speech
Speech Recognition

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-21-02

Free Spirals! by Erick Tejkowsi

Today we'll look at how to draw a spiral with REALbasic. In the process, we will also learn an important secret of top programmers: let someone else do the work!

Intro

A friend once told me that the best programmers are lazy ones. His point wasn't that lazy employees were better than hard workers. Rather, "lazy" coders are often better, because they know how to work smarter not harder.

This week we'll look at how to draw a spiral. Rather than calculate the formula to do this task, we will adapt a Visual Basic spiral example. Because of its close similarity to REALbasic, Visual Basic code is often a great source for programming ideas. The web is littered with thousands of Visual Basic code examples that are ripe for the taking.

For the first step in this week's tutorial, look at a Visual Basic spiral code example. Try to read through the code and see if you can guess how it might translate to REALbasic. Some hints might help you decipher this example:

  • Focus your attention on the Form_Paint subroutine. It is equivalent to the Paint event of REALbasic's Canvas control.
  • The coordinate system for drawing Visual Basic graphics works like REALbasic, with the origin in the top left corner of the Canvas.
  • Ditch the Declare statements. We don't need them.

Build the Interface and Add the Code

This week's example is simple to create. Launch REALbasic, open Window1 and add a Canvas and a Slider control to it. Double click the Canvas to open the Code Editor and place the following code in its Paint event:

	  
  dim x,y,n,xmid,ymid as integer
  dim angle, radius as double
  dim lastx,lasty as integer
  
  
  XMid = Me.Width / 2
  YMid = Me.Height / 2
  lastx=XMid
  lasty=YMid
  g.foreColor = rgb(255,255,255)
  g.fillrect 0,0,me.width,me.height
  g.foreColor = rgb(0,100,0)
  g.penwidth = slider1.value
  g.penheight = slider1.value
  
  For n = 1 To 1000
    Angle = n * 0.1
    Radius = Radius + Angle * 0.01
    x = XMid + Cos(Angle) * Radius
    y = YMid - Sin(Angle) * Radius
    g.drawline x,y,lastx,lasty
    
    lastx = x
    lasty = y
  next
  
	

Finally, add the following line of code to the ValueChanged event of Slider1.

	Canvas1.refresh 
	

That's it! Select Debug-Run to test your work. Then, go back and compare your code with the Visual Basic version. Can you figure out how we replaced the drawing commands from Visual Basic with the drawing commands of REALbasic? We also added a little fanciness to the project to make it a tad more interactive. The slider control changes the width of our pen which draws with a green color.

Your final result should look something like this:

spiral.jpg (39k)

Conclusion

As you can see, borrowing code has its benefits. This example was easy, but calculating a formula for drawing sprials is not something that immediately comes to mind for most people. With a little mental work, you can adapt existing code examples to suit your needs. And, never forget the programmer's motto : "REUSE CODE!". If you don't believe me on this one, take a look at the DLL folder in Windows some time. Download the finished product here and see you next week!


2-19-02

REALbasic News by Erick Tejkowsi

Carbon or Cocoa ? Many people are confused by references to Carbon and Cocoa. Geoff Perlman, CEO of REAL Software, explains what they are, what impact they have on you as a Mac user, and what that means to users of REALbasic. Check it out today!

REALbasic 4.0.2fc3 REAL Software has posted a "final candidate" of the forthcoming REALbasic 4.0.2 maintenance release.

Plucky is Ducky! Plucky is a full featured headline grabber for your desktop that is written in RealBasic. Plucky has full support for multi-threading and can visit over 4,000 websites. Thanks to great libraries from RealBasic users, many of the features of MacOS X are implemented, such as dock icon notification and a dock menu. You can get it here.

New Version of Component X Graphics Component X Graphics 2.1 speeds up high quality free rotation by 3.5 times or better compared to previous versions. It also speeds up high quality stretching by 10% or better.

Scrolling Credits ScrollCredits 0.1b1 is the second (public) plugin from a person known only as "ra". The plugin lets you incorporate scrolling credits in your application. You can choose the color of the text and the backgound or you can choose a picture for the background. It includes a fade-in/fade-out effect. You can download it here.


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