REALbasic University Resources:

RBU: Glossary Defines common REALbasic programming terms
  Archives Previously published columns
Translations: Dutch Courtesy of Floris van Sandwijk
  Japanese Courtesy of Kazuo Ishizuka
  Chinese Courtesy of Dong Li
  RBU Translation Guide Information on Translating RBU into other languages
Books: Matt's Book (2nd Edition!) Ideal for experienced programmers
  Erick's Book Best for beginning programmers
Websites: Mother Ship The publisher of REALbasic
  RB Webring Links to hundreds of REALbasic websites
  RESExcellence Another REALbasic programming column
  REALbasic Developer Magazine The premiere source for REALbasic instruction.

REALbasic University is Sponsored by

Make your Mac do what YOU want it to. Create games, utilities, cool Mac OS X tricks. Download REALbasic now and create your own software.


Print This Article

REALbasic University: Column 068

Review: REALbasic 4.5 (Part 2)

Last time I started reviewing REALbasic 4.5, and quickly discovered there's just too much stuff to cover in one column. After exploring some of the smaller innovations of 4.5, today we're going to look at some of the major new features added.

Major New Features

I've been using RB 4.5 for a few weeks now and the most amazing thing is that there are so many new features I haven't even gotten to try them all yet!

Vector Graphics

After a couple of weeks with the new version I was exploring the online help one day and saw something about vector graphics. I'd forgotten all about this incredible feature.

If you're not familiar with graphics terminology, there are two primary types of computer graphics: bitmap and vector. Bitmap graphics are the type most of us are used to and consist of pictures where every dot in the draw is specified pixel-by-pixel. A program like Adobe Photoshop, for instance, is designed to let you edit the individual pixels of a photo.

The problem with bitmap graphics is that enlarging the graphic reduces the quality. If you've got a drawing that's exactly 205 pixels by 117 pixels, where do the extra pixels come from when you stretch it to 300 pixels wide?

The answer is that the computer, via an algorithm (a formula), fabricates those extra pixels. That's what causes those infamous "jaggies" you see in some digital photos. Sometimes it doesn't look too bad. Sometimes it's horrible. It all depends on the amount of enlargement, the amount of detail in the picture, and the quality of the enlargement algorithm.

Vector graphics, however, don't suffer from enlargement problems. Vector graphics are mathematical formulas for how a graphic should look. For instance, a rectangle starts here and is this wide and this tall. If the computer knows how to draw the shape of a rectangle, it can draw it at any size we want and it will always look sharp and clear.

Of course vector graphics aren't just limited to rectangle or even basic shapes like circles. By using curved lines -- and recording the angles of those curves precisely -- we can regenerate complex drawings at any size with no loss of quality.

Take a look at the results of this simple vector demo program I wrote:

Note that the shape of the curve remains constant at every zoom level.

REALbasic's implementation of vector graphics is quite powerful. There's a built-in scaling command (that's what I used in the above demo), as well as a rotation feature (also part of the demo). If you'd like to try out this demo, you can grab the project file here (keep in mind this requires REALbasic 4.5 to function).

Of course I'm just barely touching the surface here on the capabilities of vector graphics. There are several different kinds (classes) of vector objects we can draw, including stringShape (text) and pixmapShape (bitmap). That means, yes, you can draw text and photos and REALbasic will zoom/rotate them for you!

You can also group several drawn objects together and operate on them as one command (zoom or rotate). That's just like the "group" command in many drawing programs.

For more on vector graphics, read RB's online help on the subject:

REALbasic's new vector graphics give you the power to write your own Adobe Illustrator clone, if you wish. There are even a couple new methods added to the folderItem object that let you read/write a vector graphic picture!

New ListBox Features

One item that's been improving with each REALbasic release is the powerful ListBox control, and in 4.5 it gains two very handy new features. Those are drag-to-reorder rows and resizable columns. Both of these were achievable via custom class workarounds, but it's much better to have the features part of the standard control.

You enable both of these features via checkboxes on the listBox Properties palette:

That's all you have to do! Now your listBox will automatically let the user resize the columns:

and drag the rows around:

Totally sweet. You can see that REAL Software added a couple new events to the listBox control (the background window is an RB 4.0 screenshot):

Of particular importance is the DragReorderRows event, which gets fired whenever the user changes the order of the rows. If you return true in that event, REALbasic won't automatically rearrange the rows (you have to do it yourself). If you have a hierarchal listBox (with folders, like a Finder list) that's your only choice: RB won't do it for you (I have no idea why).

Well, that's it for this column. Next we'll continue by looking at some more big improvements in RB 4.5.

If you would like the complete REALbasic project file for this week's tutorial (including resources), you may download it here.

Next Week

We continue covering more of RB 4.5's major new features.

News

REAL Software has replaced their "REALbugs" application with a new online bug database. This system is searchable, so if you experience a problem with REALbasic you think might be a bug, search for it online first to make sure no one else has already reported the problem. If it's a new bug, you can complete a form to add the bug to the database.

This is a much requested feature and REAL Software has been working hard to implement this for a long time. It will make fixing problems with REALbasic faster, so be sure to take advantage of this.

Letters

This week we've got an interesting letter from Robby, who's just starting out with REALbasic. He's got an excellent question: where to start?

Hello.

First, let me give you some background information. I sell cars. I have always been good at sales for several reasons. One reason is my superb follow-up skills. I have recently started looking into customer follow-up programs such as Power On Software's Up To Date & Contact, ACT, and others as well. These problems are good, but they do not have quite all of the capabilities that I would like. That's when I got frustrated and decided that if I can't find a program that does what I want then I would create it myself.

The problem with this--I am not a programmer! I did take a Fortran class back in college and I had a lot of fun with it. I also have done extensive work with HTML. But unfortunately, this won't get me anywhere. I asked around and the logical answer seemed to be REALbasic. I downloaded the demo and I have even created most of the program interface. But now I am stuck. I can't figure out how to do something as simple as click a button to open a window. This is very aggravating. I searched around a little on the net and I found your REALbasic University program. I even subscribed to it, but my thirty day trial of REALbasic will soon expire and I haven't done enough with the program to determine if it will actually do what I need it to do. I called a couple of bookstores and there are a few books on REALbasic 2.5 but nothing on 4.5.

Can you point me in the right direction please? I understand that you can not start over at the begining of your class and teach me, but I am willing to learn if someone can help me get started. I am very excited about the customer follow-up program that I have nearly designed and I truly do not want it to be another unfinished item on the back shelf.

Thank you,

Robby Cochran

Thanks for the great letter, Robby! I would say you are the ideal kind of person to use REALbasic. You're not a programmer, but you need a custom program because the existing software doesn't do what you want. Countless people -- myself included -- fell into programming in this same manner.

Next, let me give you some encouragement and discouragement. First the encouragement.

I urge you to purchase a license to REALbasic -- $100 for the Standard version is all you need for now (actually less than the cost of Now Up-to-Date & Contact!) -- and begin working on this project. You'll find the payoff will be enormous: you'll learn volumes, not just about programming, but about creating. If you eventually share your creation with the world, you'll make friends all over the globe and possibly bring in some decent spending money (you probably won't get rich, though anything's possible). Most likely this first project will lead to others, perhaps new kinds of software unique to your experience as a salesperson.

Now for the discouragement. Programming of any kind, even scripting in AppleScript or for the web, is complicated work. An environment like REALbasic makes it far easier than in days past, but RB isn't going to magically do what you want. Writing a contact management program won't be easy: it will take dedication and many hours of your time. Especially if you have no background in programming, you'll have to learn a lot about basic techniques in addition to the specifics of REALbasic.

Just how badly do you want to do this? I don't want to deceive you. Such a project could take anywhere from a few weeks to a few years of effort. However, if you're game, and willing to invest your time, REALbasic is the perfect environment for such a project.

That said, let's assume you want to do this. How do you go about it?

First, go ahead and purchase a license. A thirty-day trial is good just to see what RB can do, but it's not enough time to write your first project from scratch. For now, just get the Standard license. You can always upgrade later to the Pro version if you need database capabilities (which, considering your project, I'd recommend). The Standard version lets you test the database capabilities but limits you to 50 records. That should be enough to test your program and make sure it's working.

Second, read through the entire REALbasic University archives: today's lesson is our 68th so there's a huge amount of material there for you to explore. Just like the books out there, some of the older material is geared toward older versions of RB, but most of the basics are valid. (In fact, the most common thing you'll find is that limitations and problems with older versions of RB are no longer applicable.) Buy one of the books -- I recommend you look through them first, to make sure you get one that both has the basic info you need and has an approach you can appreciate. Finally, in blatant (but genuine) self-promotion, I'd recommend a subscription to my own REALbasic Developer magazine.

Third, programming is 80% planning and design. If you've got a good vision for what you want the software to do and how it should work (especially what makes it unique), you're halfway there. Don't worry too much (especially early on) about the minor technical details -- those can always be solved. When I first got started with REALbasic I would spend a whole Saturday trying to get one feature working. I didn't know what I was doing so I'd just dive in a try something. It wouldn't work, so I'd try something else. Eventually I managed to get something functioning, but years later the way I'd programmed that feature (badly) caused me headaches. Eventually it all had to be ripped out and rewritten properly. Later, I realized I had been focusing on the wrong thing, worrying about the coding of one minor feature when I should have done my research first. If I had checked around on the 'net for sample code or read a book on algorithms I might have discovered someone else had already solved my problem or learned how to write the first right from the start.

Finally, let me offer a suggestion for you. Your contact management program might be too much of a project for you to attempt as your first REALbasic application. You could try writing a simpler version first, just to get you started and test out your ideas. Another approach is this: why not find a more experienced REALbasic programmer and offer to collaborate? You'd have the concept and the vision, the other the RB expertise. This would most likely mean you'd have to go the shareware route and sell your program so you could split the profits with your partner, though I have heard of arrangements where you simply pay a partner to help you. With a partner you're not on your own, you can share ideas and brainstorm, the work goes faster with the two of you doing it, and if either of you get stuck on something, the other is there to bail the other one out. Plus you get the benefit of learning REALbasic without the stress of walking a tightrope by yourself!

If you go with a partner, go carefully: make sure it's someone you can get along with, that they are willing to put in the same time commitment as yourself, and though it hopefully wouldn't be an issue, if you're really serious, it might be worth having a lawyer draw up an agreement of some kind. You wouldn't want the other guy stealing your ideas and marketing them on his own.

How do you find a partner? Well, you could ask around on the REALbasic mailing list. You could also put in a Classified Ad in REALbasic Developer magazine.


About the Column
REALbasic University is a weekly instructional column on programming with REALbasic and is brought to you by REALbasic Developer, the magazine for REALbasic programmers.

Each week we answer select reader questions, and we're always open to ideas for future columns. Send your questions to . (Keep your questions simple and specific. General queries like "How do I write my own web browser?" will be neglected.) Your question won't be answered immediately, but will be answered in a future column. (If you don't want your correspondence published, just be sure to indicate that when you write. Otherwise it's fair game.)

About the Author
is an author, philosopher, graphic designer, photographer, film director, soccer fanatic, and programmer (among other things). He writes for MacOpinion, runs his own software company, Stone Table Software, which sells the revolutionary Z-Write word processor, and is Publisher and Editor of REALbasic Developer. He lives in Northern California with his cats, Mischief and Mayhem, and is rapidly running out of free time.

See the REALbasic University Archives


REALbasic University contents ©2001-2004 by Marc Zeedar and REALbasic Developer. All Rights Reserved.

.

.