Email:   


Home
In This Issue
Email a Friend
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.


Resources, forms and controls (continued)

Resources are just data structures
For the most part, we don't care about the resource's structure itself; just what capabilities that resource has, how we refer to the resource, and what we can do with it. String resources are just that: a text string. We can request a pointer to the string, and we can use the string (referenced via that pointer) or we can reference the string by another resource (as the 'help' message for a form, for example). Form resources are far more complex, but we simply refer to them by their identification number; we would call FrmGotoForm(1000) to go to form number 1000.

Each resource is identified by a resource type and an identification number. Palm has defined a number of resource types. Some of these will already be familiar to Macintosh programmers. Each resource type is a four-character name; the string resource above is 'tSTR'. The resource-development tools handle all the name issues for us, but it's useful to be familiar with them; occasionally you'll see reference to "a Talt" or "a tAIN" resource. The sidebar "Resource Types" lists many of the common resource types.

Forms are a collection of resources
Each of the controls on a form can be a resource by itself, but when they're built into a form, they become an integral part of the data structure defining that form. The form data structure contains information about the form itself (such things as height and width); the data structure for each control is concatenated to the form's structure.

Other resources, such as the help message or the form's menu, are separate resources within the application file but are referenced from the form's data structure. This all happens automatically. You don't need to do anything special to make this happen. You simply build a form using the appropriate tools for your development environment. The tools build the right structures.

Building Resources
CodeWarrior and GCC use different tools to build resources.

CodeWarrior provides a graphical utility called "Constructor" while GCC uses a text script and the PilRC utility. Unfortunately, there's no easy way to convert from one to the other. If you have a program written using one compiler, it's pretty easy to compile it using the other, but the resources need to be recreated manually.

Building resources with CodeWarrior's Constructor
While a complete tutorial on Constructor is beyond the scope of this column, the basics are described here.

You open a resource "project" which shows a list of the various resources for that application. Figure A shows the resource project for the "hello world" application. This project is different than the CodeWarrior IDE (Interactive Development Environment) project; the IDE project file uses an .MCP extension while the resource project is a .RSRC extension. The .RSRC file will be included in the IDE's project as a dependent file.

FIGURE A

Constructor displays the .RSRC file as a list of resources. Click picture for a larger image.




[ Prev | Next ]

-- Advertisement --

ONLINE GROUP CALENDAR - FOR UP TO 100 OF YOUR CLOSEST FRIENDS
Stay organized and in control with 24/7 access to all of your important events, projects and files --whether you're at work, at home or on the road.

You can share your calendar, projects and files so everyone in your office is up to date. Plus, search your entire group to find times when everyone is available to meet, manage company resources and much more.

Organize your entire team for as low as $9.95 per year (and yes, that's where the decimal place is supposed to be!)

Tap here to get started right away.

-- Advertisement --

SECURE YOUR SITE WITH AN IRONCLAD SSL CERTIFICATE
An IronClad SSL Certificate helps you build an impenetrable fortress around your customer's credit card information. IronClad SSL Certificates are:

  • Fully validated
  • Up to 256-bit encryption
  • Up to 10 years validity
  • Stringent authentication
  • Around-the-clock customer support

Build trust. Protect your customers. Grow your online business.

Tap here now and be IronClad with SSL tonight.

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.