Menu Resources
Menus
are created and stored as resources in your application. Depending on
the development environment you use, you make the menus in different
ways. First, we show you how to create menus with PilRC (the GNU
PalmPilot SDK resource creator) and then using CodeWarrior’s
Constructor. In either case, the menus end up in a
.PRC
resource file.
The .PRC file
The .PRC
file contains an MBAR resource for
each menubar in your application. These MBAR resources are in turn
composed of a number of menus, each of which contains menu items.
Each menu item has associated with it a menu ID and, optionally, a
shortcut key. When you design your menubars, you need to make sure
that no two menu items in menus displayed at the same time have the
same key shortcut—each shortcut must be unique.
Using PilRC
To create your
.PRC
file using GCC, use the PilRC Resource
Compiler. PilRC allows you to directly create menubar resources;
later you will learn that this is a tremendous advantage. PilRC is a
textual, rather than a graphical, resource editor.
Here’s a simple MBAR (ID 1000) Resource with two menus, each with two items (the item IDs are 1001, 1002, 1011, and 1012):
MENU 1000 BEGIN PULLDOWN "Menu1" BEGIN MENUITEM "Item1" 1001 "I" MENUITEM "Item2" 1002 END PULLDOWN "Menu2" BEGIN MENUITEM "Item3" 1011 MENUITEM "Item4" 1012 END END
To define the shortcut keys of menu items in PilRC, simply supply the character surrounded by double quotes. In our simple example, the first menu item has a shortcut ...
Get Palm Programming: The Developer's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.