O'Reilly logo

REALBasic: TDG, 2nd Edition by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backdrop Property

At last we are ready to display some images! Recall that we can do this in one of two ways: by way of a Canvas’s (or window’s) Backdrop property, and by way of its Graphics property. This section is about the first of those ways.

The Backdrop property of a Canvas (or a window) couldn’t be simpler; it is just a reference to an instance of the Picture class. Once this reference is set, REALbasic automatically displays that Picture’s image, with its upper left at the Canvas’s (or window’s) upper left, and maintains it for you. I will illustrate (to coin a phrase) under five headings, corresponding to the five ways in which a Picture instance can be obtained (as enumerated in Section 11.2.2, earlier in this chapter).

In these initial examples, I set the Canvas’s Backdrop property once, presumably when the application starts up. However, it’s important to understand that you aren’t limited to this. You can set a Canvas’s Backdrop property at any time. If the Canvas’s Backdrop property is already set to point at a Picture instance, you can set it to point at a different Picture instance. Or, if the Picture instance that the Canvas’s Backdrop property is pointing to has a non-nil Graphics property, you can write into that Graphics property to change the Picture’s image. Either way, the image displayed by the Canvas will change appropriately. Also, in these examples, I assume that the code belongs to the Canvas instance in the window (for example, it appears in its Open ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required