|
|
|
|
|
|
|
|
Resources, forms and controls (continued)
"Form ID" is the resource's identification number. Remember when I said resources have a type and an ID? This is the ID. The type is 'tFRM' by the way.
Constructor can create a header file with these IDs. See Listing 1 (see http://www.component-net.com/pp-extras/mainform.html); near the bottom where it says "header file name" and "auto generate header file" is checked; this tells Constructor to write all the IDs in a file called HelloRsc.H. In this case, the form name will be MainForm.
"Help ID" isn't used in this particular form. That's why it's greyed out. If we wanted a help message for this form, we would make the ID a number other than zero, and we would define a string resource with the text. The Create button is a convenience; we could also go to the project window, click on "strings" and then create a new string by selecting New String Resource from the Edit menu command.
When a form has help text, the form displayer automatically makes the menu bar the full width of the form, and puts the "i" button at the right.
"Menu bar" indicates the identification number of the menu resource. Like Create for the help ID, the Edit button is a convenience. If the menu resource hasn't been created, the edit button will be a Create button.
When the system closes a form automatically, as it would when it switches to another application, it will simulate pressing the "Default button ID" button. In this case, there is no default button.
Finally, the "form title" is just that: the title shown on the menu bar. The "hex" button displays the title text as hex values. This is convenient when using non-alphanumeric characters.
Looking at Listing 1 (see http://www.component-net.com/pp-extras/mainform.html), you can see how PilRC uses similar terminology to define the form. "FORM ID MainForm AT (0 0 160 160)" indicates the top and left origins and the height and width. "MENUID MainFormMenuBar" indicates the ID number of the menu resource, which is defined a few lines later.
Next month Now that we've finished our coffee (and in a few cases, the whole pot!) we'll tie things off here. Next month we'll look at some of the user-interface controls; what they do and how to use them.
Common Resource Types Each resource is identified by a type and an ID number, as shown in Table A. These are some of the common types; you'll occasionally see them mentioned in articles or newsgroup and maillist messages. For the most part, you won't deal with the type codes; you'll just deal with a resource of a particular variety. The type codes are case-sensitive.
| Resource |
Description |
| code |
program code |
| data |
program data |
| MBAR |
menu bar (typically referenced by a form resource) |
| MENU |
menu options (referenced by a MBAR menu bar) |
| tAIB |
icon bitmap; the icon displayed by the launcher |
| tAIN |
application name; the name displayed on the launcher. |
| tAIS |
application information string, a series of strings, typically passed to CategoryIntitialize() as the initial category names |
| Talt |
"Alert" dialog |
| Tbmp |
bitmap resource |
| tBTN |
button control |
| tCBX |
checkbox control |
| tFBM |
form bitmap |
| tFLD |
field control |
| tFRM |
form |
| tGDT |
gadget control |
| tGSI |
graffiti shift indicator |
| tLBL |
label |
| tLST |
list box |
| tPBN |
pushbutton control |
| tPUL |
popup list |
| tPUT |
popup trigger |
| tREP |
repeating button control |
| tSLT |
selector trigger |
| tSTR |
String resource - simply a text string |
| tTBL |
table |
| tTTL |
title |
| tver |
application version information |
|
Alan Weiner is an independent software developer and a Senior Engineer at Communica, Inc. His email address is alan@ajw.com.
|
|
|
|
|
|
|
|
|
|
|