| Tutorial | Exit |
Caution: In all the following keyboard examples, Mops commands are always terminated by «enter», and «enter» is not the same as «return». Many Mac applications treat these two keys as equivalent, but Mops doesn't. Once you've used Mops for a while you'll come to appreciate the usefulness of this feature.
To use the online glossary in QE, just highlight a word, and choose Glossary under the Mops menu, or hit command-Y. Also, in the Glossary window, if you start typing the name of the word you want to look up, you'll be taken there. You'll find further instructions for using QE in the Readme file in the "Quick Edit " folder.
In addition, QE is a proper standalone source-text editor for Mops programs.
Mops, itself, includes many predefined types of object. With this preexisting framework, you can create complex objects as simply as typing two words. Let's do that right now, so you can get a taste of what Mops has in store for you. This is just a demonstration, not a lesson. So type (or copy & paste) along with us and observe what happens without trying to remember each step.
(Although there is a Mops-68K, comprised of the Mops and Mops.dic files, as well as the PPC-native PowerMops, it doesn't matter which application you use. Procedurally they are virtually identical. The principal difference is that to invoke Mops-68K you doubleclick on the Mops.dic file. Everything we say here applies as well to both.)
Open the Mops folder. Locate the Mops.dic icon and doubleclick it. In a moment, the Mops window appears. We'll explain the window's contents in detail in Lesson 1, but for now, create a rectangle object—called "box"—in memory by typing:
rect box
(Remember to hit «enter» at the end.)
We need to tell box where on the screen it should appear, and how big it should be. The rectangle framework inside Mops wants these instructions in the form of screen coordinates for two opposite corners, the top left and bottom right. We'll choose 20, 10 for the top left, and 200, 100 for the bottom right. Put these figures into box's memory by typing the following line, making sure you observe the spacing between elements and the colon:
20 10 100 50 put: box
This line is called a message, which we just sent to box. Now we want to send messages to box so that it will draw itself on the screen. First, however, it will need a window to draw itself in. To set up a window object—named "ww"—in memory, type:
window ww
Macintosh windows need a lot of information before they can be placed on the screen, including the rectangular limits of the window, the title of the window, the type of window, whether it is to be visible, and whether it has a close box. Even then, the Macintosh Toolbox requires much more information, which Mops automatically supplies. Some of the Mops classes, including Window, have test or example methods that display an instance of that class, with typical values. To see the window you just created, type the following message:
test: ww
|
Your screen should now look something like this:
Actually, I cheated by select-and-dragging the instructions from the browser. |
|
You will be able to resize and drag ww around the screen as for any Mac window. But if you type keys while ww is in front, nothing will happen—this is simply because we haven't told ww what to do with keys. So move ww out of the way, and click on the Mops window so you can type further commands. Resize the Mops window if necessary so that ww is still visible.
Now type:
set: ww draw: box
|
The message "set: ww" tells the system that drawing is now to take place in ww (but without bringing it to the front). Box should now appear in ww, and your screen should look something like this (of course you might have put ww in a different place):
(We have shrunk the window's width to expose the background box.) |
When you are finished experimenting, select Quit from the File menu, or type
bye
in the Mops window to quit Mops
Now let's move on with the Tutorial, and I hope you find you enjoy Mops.
| Previous Index | Opener | Next Index |
|---|---|---|
| ⇧ | ||
| This page online: http://PowerMops.com/MopsManual/Lessons/Contents.html | ||