Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
Resources, forms and controls (continued)

Figure B shows the application's main form. The left pane shows the form's information. Simply click on a field to change it.

FIGURE B

The form resource. The left pane shows the form's parameters. Click picture for a larger image.

As the form is changed, the right pane displays the form's image. To place a control (i.e., a button) drag it from Constructor's "catalog" window, as shown in Figure C, and drop it onto the form.

FIGURE C

The "catalog" of controls; drag-and-drop these onto forms. Click picture for a larger image.

Selecting a control by dropping it onto the form or by clicking on an existing control allows you to edit the control's data. Figure D shows the form with the label control selected. The left pane shows the label's data.

FIGURE D

The same form resource as in Figure 2, after clicking on the "hello world" label. Click picture for a larger image.

There are several glitches with Constructor, at least on the Windows version. These will likely be fixed in future releases, but I'll list them here to save you some hair-pulling.

First, Constructor creates two .RSRC files: the first is a zero-length file, the second is in the Resource.frk directory beneath it. That second file is the one with the real information in it, but the IDE project should include the first (zero-length) file. If you accidentally include the lower file, you'll get problems with linking. This is an anomaly due to the tools Metrowerks uses; the tools allow them to create both a Macintosh and Windows version. It's odd, ugly, and the way things are. Just mentally ignore the copy in Resource.frk (the one with the actual data) and always refer to the zero-length file. If you have problems opening a resource project you may be opening the wrong one.

Second, no you can't double-click on the resource file in the IDE and open up Constructor (as you would double-click on a source file to edit it). You need to start Constructor and select Open Project File from the File menu. Be sure to open the upper (zero-length) .RSRC file - Constructor knows to open the real one beneath it.

Third, creating an image using Windows Paint and cut-and-pasting it into a bitmap resource in Constructor will sometimes fail. When it does, you'll see the image, but as if it's been shifted horizontally. If this happens, change the Paint settings so you're creating a color bitmap. Then you should be able to cut-and-paste it successfully.

Despite these problems, Constructor is convenient and fairly easy to use.

Building resources with GCC (PilRC)
GCC uses the PilRC utility to compile a text script into the resource data structures. You describe each resource with a series of commands.

Listing 1 shows the resource script (see http://www.component-net.com/pp-extras/mainform.html) for the "Hello World" application. The line starting with "LABEL" describes the same label displayed in Figure D.

The ID numbers are defined in the include file "hello.h"

One major advantage to PilRC is that this script is easily printed. It would be quite difficult to describe the Constructor-built resources in human-readable terms.




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login