Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
PROGRAMMING POWER
Resources, forms and controls
By Alan Jay Weiner

Last month, we walked through a "simple" "hello, world" application. While we covered the code in almost tedious, thorough detail, I glossed over the resources somewhat. Resources are as important as the code itself; they're intricately entwined together. So this month we'll look at resources, forms, and controls. Grab a cup of coffee and let's begin!

What are resources?
Resources are "things" that a program can use. A resource could be as simple as a text string or as complicated as a screen form with menus, buttons, fields, and other resource "things." Forms and controls are types of resources.

Resources are essentially data structures tacked onto the end of the program file. Some Palm OS APIs expect to use certain resources; others you use by requesting a pointer and using the data at that address. For example, you might want to display a bitmap with your company logo. With the bitmap attached as a resource, you'd get a pointer to it by calling DmGet1Resource(), then display the bitmap by calling WinDrawBitmap(). Attaching the bitmap as a resource saves you from using up precious limited data and program space. While the resource could simply be in a separate data file, attaching them to the program is convenient - they're always there when you need them.

Resources can also be modified without changing the program itself. For example, if an application's text messages are all resources, changing the messages to a different language involves just using a different set of resources, rather than recompiling the program.

Some resources can refer to other resources. For example, a form resource is built out of a collection of control resources (buttons, fields, lists, etc.). Rather than using each resource individually, you'd simply say "display the form" and the OS's form-displayer knows to display all the other resources. That form might also have a "help" message which would point to a string resource. When the user hits the "i" on the menu bar, the form handler automatically displays the string resource.

After the program is compiled and linked, another tool builds the necessary data structures from a description of the resources, then attaches those structures to the program file. The program carries the resources on its back like a camper with a backpack full of supplies.

"Hello world" only used a few resources. It uses a couple of forms, a couple of menus, and a bitmap. Most programs use many more. In fact, even the program's code and data are stored as resources; the .PRC file is a header structure followed by everything else as various resources.


1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: The iPad: Apple's latest heartbreaker
David Gewirtz Online: CNN commentary and analysis
DominoPower: Lotusphere 2010: mobility and collaboration
OutlookPower: Running auto-respond rules when Outlook is closed
-- Advertisement --

BLOGGING AND PODCASTING WITH ONE EASY-TO-USE TOOL
Now you can publish your thoughts, opinions, and comments in your own blog or podcast.<p />

  • Supports multiple authors and multiple blogs or podcasts.
  • Generate and publish RSS feeds for iTunes and other directories.
  • Post photos, images or animations.
  • Get feedback and have conversations with visitors to your site. <p />

Personalize your blog or podcast with your own unique domain name -- or integrate it with your existing site by setting it up as a subdomain.

Tap here and get blogging or podcasting within minutes.

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