Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 1.4

COLUMN

Welcome to the REALbasic Developer Magazine Beginner's Corner!

Issue: 1.4 (February/March 2003)
Author: Thomas J. Cunningham
Article Description: No description available.
Article Length (in bytes): 7,967
Starting Page Number: 28
Article Number: 1414
Related Link(s): None

Excerpt of article text...

This month and next month, I will discuss the subject of drawing in REALbasic, commonly known as graphics. Now let me briefly explain what I mean by drawing. The big picture is that everything you see on a computer screen has to be drawn to the screen by your computer. This is accomplished by using the tiny little squares that comprise your computer screen. Launch REALbasic, press Command-1, type in the word "graphics," and look through the properties and methods of this class.

Pixels ' Resolution

The tiny little squares I mentioned above are called pixels. They are laid out in a grid pattern of rows and columns. The number of rows and columns shown on your computer screen are collectively referred to as your monitor's resolution. My iMac, at the moment, is set at 1024 pixels by 768 pixels. So I have 1024 pixels from left to right and 768 pixels going up and down my screen, for a total of 786,432 pixels. The physical size of my screen is about 12 inches wide by 9 inches high. So at this screen resolution, I have about 85 pixels for every inch horizontally and vertically.

Each of these pixels has a defined location within the screen. In beginning algebra, you were taught to set up a coordinate system that was comprised of a horizontal "X" axis and a vertical "Y" axis. Where these two axes crossed, they were labeled as the origin. And this origin was labeled as zero and zero: positive x values to the right, positive y values moving up.

Computers are laid out using a similar concept, but in a different manner. On a Mac, our origin is at the top, left corner of the screen (or window). The x coordinates are positive moving to the right, but the y coordinates are positive moving down the screen. On my monitor, the pixel in the middle of the screen would be described as position 512,384. That's 1024/2 and 768/2.

It's important to understand this way of describing a position in RB. I strongly suggest that you go out and buy yourself a nice notebook of graph paper. I use this graph paper as a way of wrapping my head around positions in my programs a lot. It will save you many hours of frustration when something you draw on screen doesn't look right or isn't placed where you wanted it to be shown. Figure 1 shows a magnified view of an area six pixels wide by six pixels high and how each of the individual pixel boxes are identified. As an exercise, fill in the pixel x and y positions I have left blank.

...End of Excerpt. Please purchase the magazine to read the full article.