Академический Документы
Профессиональный Документы
Культура Документы
Creating Resources, 12
Running the Resource Editor, 12
Creating string resources, 13
Creating image resources, 15
Creating dialog resources, 17
iii
Contents
Index, 40
iv
Introducing the
BREW Resource Editor Guide
The BREW Resource Editor Guide describes the Binary Runtime Environment for Wireless™
(BREW™) Resource Editor, subsequently referred to as the Resource Editor, and its role in
creating application resource files. This document explains how to create the three types of
resources:
• String resources
• Image resources
• Dialog resources
BREW Resource Editor Overview Describes the types of files, file formats, and controls that
the Resource Editor supports, and provides information to
help you start using the editor.
Creating Resources Explains how to create string, image, and dialog resources
using dialog boxes accessible from the main BREW
Resource Editor window.
Creating Dialog Controls Explains how to create various types of controls using
dialog boxes accessible from the Dialog Resource dialog
box.
Compiling Resource Files Explains how to save intermediate files and BREW
resource files.
5
Introducing the BREW Resource Editor Guide
BREW SDK User’s Guide Introduces the components of the BREW Software
Development Kit (BREW SDK™) and their relationship to
one another. The document also contains general
instructions for developing BREW applications and for
using the BREW Emulator.
BREW API Reference Provides information about BREW functions and data
structures needed to develop applications for BREW-
enabled mobile platforms.
BREW Device Configurator Guide Describes how to use the BREW Device Configurator to
create effective wireless devices for emulation by the
BREW Emulator.
BREW Resource Editor Guide Describes how to use the BREW Resource Editor to create
the text strings, images, and dialogs used by BREW
applications.
BREW MIF Editor Guide Describes how to use the BREW MIF Editor to create and
modify Module Information Files (MIF)—a special type of
BREW resource file that contains information about the
classes and applets supported by particular BREW
modules.
BREW SDK Utilities Guide Describes how to use the utilities, such as the PureVoice
Converter, included with the BREW SDK.
BREW Compressed Image Describes how to use the BREW Compressed Image
Authoring Guide Authoring Tool to create files for displaying and animating
images in your applications.
6
Introducing the BREW Resource Editor Guide
7
BREW Resource Editor
Overview
This section describes the resources, controls, and file formats supported by the Resource
Editor, and the role of the Resource Editor in the BREW SDK.
Types of resources
Using the Resource Editor, you can create, modify, or delete the following three types of
resources:
Image An image resource contains a graphic image. Currently, BMP, PNG, and BCI images
are supported, but other graphics formats will be supported in later releases. Check
the BREW web site for current information on supported image types.
Dialog A dialog resource can be made of one or more dialog controls. The controls let the
device user choose an item from a menu or enter items such as the date, time, and
text.
Controls
Following are the types of controls supported by the Resource Editor:
Soft Key Control List of choices shown with horizontally scrolling buttons.
List Control List of choices that shows only the currently-selected menu item on the screen.
Date Pick Control List of date choices shown in a calendar format (one week per row starting from
Sunday and one month at a time).
Date Control Used for selecting dates in the “Day of Week / Month Day, Year” format.
Stopwatch Control Used for counting elapsed time from a point A to point B.
8
BREW Resource Editor Overview
Countdown Control Used for counting down from a specified amount of time to 0 (zero).
File formats
The Resource Editor uses an intermediate file format to save its contents and can support a
number of final output formats, one of which is the format used by BREW.
The intermediate format, which has the extension BRI (BREW Resource Intermediate), is an
input to the BREW Resource Compiler to produce the final output, which has the extension
BAR (BREW Applet Resource). The BREW Resource Compiler is integral to the Resource
Editor.
A header file with the suffix and extension _RES.H, for example foobar_res.h, is produced as
part of the final output. The following diagram illustrates the process. Although the Resource
Editor and BREW Resource Compiler are parts of the same entity, they are shown separately
to emphasize the role of each module.
9
BREW Resource Editor Overview
You can create a MIF for the applet with the BREW MIF Editor, subsequently referred to as the
MIF Editor, and place it in the appropriate MIF directory. You use the Resource Editor to create
a resource file that contains character strings, images, and dialogs loaded at applet execution.
The Resource Editor allows you to assign IDs to these resources and create a header file
(called app_res.h in the example) that contains these IDs. This file is included in the applet
source file, app.c, which is compiled and linked to produce the applet’s dynamic-link library
(DLL), app.dll. See the BREW SDK User’s Guide for details.
As shown in the previous figure, the Resource Editor saves the entered resource information
in a BRI file. When you modify the resource file, the Resource Editor loads its contents from
the BRI file. Any changes to the BRI file are not propagated to the BAR and _RES.H files until
you rebuild using the Resource Compiler.
10
BREW Resource Editor Overview
When you launch the BREW Emulator, subsequently referred to as the Emulator, it shows the
image of the device defined in the configuration file, dev.qsc. The Emulator looks in the
specified MIF directory and shows a menu containing all the applets with MIFs in that directory,
including the applet called app. When you choose app from the menu, the Emulator loads the
app.dll and begins running the applet. As the applet runs, it uses the resource-loading
functions in the IShell interface to load the resources it needs from the file app.bar (see the
BREW API Reference for detailed descriptions of IShell’s LoadRes and CreateDialog
functions). Each call to one of these functions includes the ID of the specified resource, which
is defined in the app_res.h header file.
To emulate an applet for different devices and languages, you can create multiple versions of
app.bar and store them in separate directories, then set the Emulator’s applet and MIF
directories appropriately. To emulate a different device, load a device configuration file other
than dev.qsc into the Emulator. See the BREW SDK User’s Guide for more information
11
Creating Resources
This section explains how to create and manage string, image, and dialog resources.
There are two methods for running the Resource Editor, from the Windows Start menu and
from the command line.
NOTE: After you have created and saved resources, you can run the Resource
Editor by double-clicking an existing BRI file.
12
Creating Resources
• For Windows 2000, choose Start > Programs > Accessories > Command
Prompt.
• For Windows NT, choose Start > Programs > Command Prompt.
<BriFile>, corresponding to the -f option, is the filename of the BRI file (including
its path).
NOTE: If the path to the BRI file contains spaces, you must enclose the path with
quotation marks. For example, if you type the path C:\Program
Files\BREW\Examples\abc.bri, all characters in the path after the word Program
would be ignored. The correct way to type the path is: “C:\Program
Files\BREW\Examples\abc.bri.”
13
Creating Resources
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Resource Name field, enter a unique name assigned to the resource you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that is valid for variable names in C/C++.
4. In the String Format field, select the format from the drop-down list. The default is
ISOLATIN 1.
5. In the Value field, enter the actual string content for the resource.
The String Resource dialog box closes, and the string resources you created
appear in the right pane of the BREW Resource Editor window.
14
Creating Resources
NOTE: Check the BREW web site for current information on the actual device and Emulator
image types.
15
Creating Resources
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Resource Name field, enter the unique name assigned to the resource you
are creating. The name must be an array of contiguous characters (no spaces
between characters) that are valid for variable names in C/C++.
4. In the Path To File field, enter location of the Image file. If needed, click Browse to
search and choose the location. The image file path can be dragged and dropped
from Windows Explorer onto the Resource Editor.
The Image Resource dialog box closes, and image resources you created appear
in the right pane of the BREW Resource Editor window.
16
Creating Resources
Menu item selection Lets the device user make a selection from a list of items. Controls in
this category include menu controls, soft key controls, list controls,
and icon view controls. Use functions in the IMenuCtl interface to
manipulate menu controls in your application.
Date display and entry Lets the device user enter and display date information. Date controls
and date-pick controls fall into this category. Use functions in the
IDateCtl interface to manipulate data and date pick controls in your
application.
Time display and entry Lets the device user enter and display time information. Stopwatch,
clock, and countdown controls fall into this category. Use functions in
the ITimeCtl interface to manipulate these controls in your
application.
Text entry Lets the device user enter text information using the device keypad.
Text controls fall into this category. Use functions in the ITextCtl
interface to manipulate text controls in your application.
17
Creating Resources
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Resource Name field, enter the unique name assigned to the dialog you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
4. In the Dialog Title field, select the title of the dialog from the drop-down list, which
must come from one of the string resource elements. These string resource
elements will become available in a future release.
18
Creating Resources
5. In the Dialog Flags field, enter the dialog property flag that determines the look of
the dialog. By default, the flags are all set to 0 (zero). Dialogs support the
CP_BORDER and CP_3D_BORDER flags, which can draw a border around the
dialog box. Please refer to the IDialog interface section in the BREW API
Reference for more information on the various dialog flags available.
6. In the Initial Focus ID field, enter the control in the dialog that has the focus when
the dialog is initially shown. By default, this is the ID of the first control you create
in the dialog.
7. In the Initial Position and Initial Size fields, enter the position (coordinates of upper
left hand corner) and size (in pixels) at the startup of the dialog. The default values
are -1 in each field, which indicates that the dialog occupies the entire device
display.
NOTE: For descriptions of the Dialog Control toolbar icons, see Creating Dialog
Controls on page 20.
8. When you are finished creating the dialog resource, click OK.
The Dialog Resource dialog box closes, and the dialog resource you created
appears in the right pane of the BREW Resource Editor window.
19
Creating Dialog Controls
This section explains how to create dialog controls of the following types:
• Menus
• Text display
In each category of control, the steps for creating a control in that category are identical.
You can create dialog controls using the dialog control icon buttons that appear in the Dialog
Resource dialog box. Each icon represents the type of control you want to create.
20
Creating Dialog Controls
The procedures in this guide describe how to perform various tasks using the icons on the
menu bar. However, you can perform the same functions using the shortcut menu that opens
when you right-click in the Dialog Controls area of the Dialog Resource dialog box, as shown
below.
Menus
BREW provides four types of menus:
• Menu control
• List control
21
Creating Dialog Controls
Menu control
Use the Menu Ctl object to create a list of choices presented as vertically scrolling text items,
similar to the list shown below.
22
Creating Dialog Controls
List control
Use the List Ctl object to create a list of choices that shows only the currently-selected menu
item on the screen, similar to the list shown below.
Use the Icon View Ctl to create a list of choices presented as icons, similar to the list shown
below.
23
Creating Dialog Controls
Creating Menus
The Menu Ctl object allows you to create a list of choices presented in the standard menu
style. After you have created the menu, you can define the items to be listed in the menu.
To create a menu
1. In the Dialog Resource dialog box, do one of the following:
a. To create a menu of vertically scrolling items, click the New Menu Control icon.
b. To create a menu of horizontally scrolling buttons, click the New Soft Key
Control icon.
c. To create a menu of vertically scrolling buttons, click the New List Control icon.
d. To create a menu of icons, click the New Icon View Control icon.
A corresponding Properties dialog box opens. For this example, the Menu
Properties dialog box is shown.
2. In the Control ID field, the number is preassigned automatically; however, you can
change it if you want a specific ID assigned. The valid ID integer range is 1 to
32767, and the ID must be unique among the controls within the resource file (BRI).
24
Creating Dialog Controls
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Control Name field, enter the unique name assigned to the control you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
4. In the Control Flags field, enter the control properties bit vector to alter the default
appearance and behavior of the control. See the BREW API Reference for the
properties associated with each type of control.
5. In the Control Title field, select the title from the drop-down menu to be shown with
the control, which must come from one of the string resource elements.
6. In the Initial Position and Initial Size fields, enter the position (coordinates of upper
left hand corner) and size (in pixels) at the startup of the dialog. The default values
are -1 in each field, which indicates that the dialog occupies the entire device
display. See the BREW API Reference for more information.
7. Click OK.
The Properties dialog box closes, and the new dialog control appears in the list
pane of the BREW Resource Editor window.
NOTE: To delete a menu or any other dialog control, select it from the Dialog
Resource dialog box and press Delete.
25
Creating Dialog Controls
The management of the list items in the Menu Properties dialog box is used in the
following example.
2. Click the New Menu Control, New Soft Key Control, New List Control, or New Icon
View Control icon. The properties dialog box opens.
3. In the List Items area, right-click and choose New List Item from the shortcut menu
as shown.
The List Item Properties dialog box opens for input. The following is a sample entry:
26
Creating Dialog Controls
4. In the List Item ID field, the number is preassigned automatically; however, you can
change it if you want a specific ID assigned. The valid ID integer range is 1 to
32767, and the ID must be unique among the list items within the resource file
(BRI).
When the device user chooses this item from the menu, a command event
(EVT_COMMAND) is sent to the applet with the list item ID as the word parameter
(wParam).
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
5. In the List Item Name field, enter the unique name assigned to the list item you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
6. In the Data field, enter the hex value associated with the list item. When the device
user chooses this list item, a command event (EVT_COMMAND) is sent to the
applet with this particular value as the double-word parameter (dwParam).
Although this value need not be unique, most items have unique data values. The
valid range of this value is 0 to FFFFFFFF.
7. From the List Item Text drop-down list, select the text that you want to appear for
this item in the menu control.
8. From the List Item Image drop-down list, select the image that you want to appear
for this item in the menu control.
The List Item Properties dialog box closes, and the new list item appears in the list
pane of the BREW Resource Editor window.
27
Creating Dialog Controls
2. In the List Items area, select the item you want to delete, then press Delete.
• Date control
28
Creating Dialog Controls
Date control
Use the Date Ctl object to create a list of dates in the Day of Week or Month Day, Year format.
29
Creating Dialog Controls
a. To create a list of dates from a scrolling monthly calendar, click the New Date
Pick Control icon.
b. To create a list of dates in the Day of Week or MMDDYY format, click the New
Date Control icon.
A corresponding Properties dialog box opens. For this example, the Date Pick
Properties dialog box is shown.
2. In the Control ID field, the number is preassigned automatically; however, you can
be change it if you want a specific ID assigned. The valid ID integer range is 1 to
32767, and the ID must be unique among the controls within the resource file (BRI).
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
30
Creating Dialog Controls
3. In the Control Name field, enter the unique name assigned to the control you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
4. In the Control Flags field, enter the control properties bit vector to alter the default
appearance and behavior of the control. See the BREW API Reference for more
information.
5. In the Initial Position and Initial Size fields, enter the position (coordinates of upper
left hand corner) and size (in pixels) at the startup of the dialog. The default values
are -1 in each field, which indicates that the dialog occupies the entire device
display. See the BREW API Reference for more information.
6. Click OK.
The Properties dialog box closes, and the new dialog control appears in the list
pane of the BREW Resource Editor window.
• Clock control
• Stopwatch control
31
Creating Dialog Controls
Clock control
Use the Clock Ctl object to create an interface that shows the time.
Stopwatch control
Use the Stopwatch Ctl object to create an interface that measures elapsed time from any
arbitrary time point (A to B).
32
Creating Dialog Controls
Countdown control
Use the Countdown Ctl object to create an interface that counts down from an arbitrary amount
of time to 0 (zero).
a. To create an interface that shows the time, click the New Stop Watch Control
icon.
b. To create an interface that measures elapsed time, click the New Clock Control
icon.
c. To create an interface that counts down to zero, click the New Countdown
Control icon.
The corresponding Properties dialog box opens. For this example, the Stop Watch
Properties dialog box is shown.
33
Creating Dialog Controls
2. In the Control ID field, the number is preassigned automatically; however, you can
change it if you want a specific ID assigned. The valid ID integer range is 1 to
32767, and the ID must be unique among the controls within the resource file (BRI).
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Control Name field, enter the unique name assigned to the control you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
4. In the Control Flags field, enter the control properties bit vector to alter the default
appearance and behavior of the control. See the BREW API Reference for more
information.
5. In the Initial Position and Initial Size fields, enter the position (coordinates of upper
left hand corner) and size (in pixels) at the startup of the dialog. The default is -1 in
each field, which indicates that the dialog occupies the entire device display.
6. Click OK.
The Properties dialog box closes, and the new dialog control appears in the list
pane of the BREW Resource Editor window.
34
Creating Dialog Controls
Text entry
BREW provides the following control for entering text information.
Text control
Use the Text Ctl object to create an interface for inputting, outputting, and manipulating text.
35
Creating Dialog Controls
2. In the Control ID field, the number is preassigned automatically; however, you can
change it if you want a specific ID assigned. The valid ID integer range is 1 to
32767, and the ID must be unique among the controls within the resource file (BRI).
NOTE: Within a given BRI file, all resources of a given type (strings, images,
dialogs, and all kinds of controls) must have unique ID numbers. For example,
when you are creating a BRI file for an application, you can assign Resource IDs
001, 002, and 003 to image resources, Resource IDs 001, 002, and 003 to string
resources, and List Item IDs 001, 002, and 003 to menu control list items. You
cannot, however, assign Resource ID 001 to two Image resources within the same
BRI file.
3. In the Control Name field, enter the unique name assigned to the control you are
creating. The name must be an array of contiguous characters (no spaces between
characters) that are valid for variable names in C/C++.
4. In the Control Flags field, enter the control properties bit vector to alter the default
appearance and behavior of the control. See the BREW API Reference for more
information.
5. In the Initial Position and Initial Size fields, enter the position (coordinates of upper
left hand corner) and size (in pixels) at the startup of the dialog. The default values
are -1 in each field, which indicates that the dialog occupies the entire device
display. See the BREW API Reference for more information.
6. In the Control Title field, select the title to be shown with the control.
36
Creating Dialog Controls
7. In the Control Text field, select the initial text to be shown in the text control area
from the drop-down list.
8. Click OK.
The Properties dialog box closes, and the new dialog control appears in the list
pane of the BREW Resource Editor window.
37
Compiling Resource Files
All three file types (BRI, BAR, and _RES.H) are placed in the same directory. If you try to
generate the final output without saving the intermediate file, the Save dialog box prompts for
the name and directory path of the intermediate file. The same directory and root name (BRI
filename without the BRI extension) are used to generate the BAR and _RES.H files.
Conversely, if the intermediate file is saved before generating the BAR file, you are not
prompted for the name and directory path. The Resource Editor uses the stored directory
name and root name of the intermediate file to generate the final output filenames.
38
Compiling Resource Files
If you have already saved the intermediate files, the final output files are saved. If
you have not previously saved the intermediate files, the Save As dialog box
opens.
2. Indicate where you want the BRI file stored, assign it a name, and click Save.
39
Index
A Dialog controls
icon view, 23
Acronyms and terms, 6 list, 23
ARM compiler, 11 menu, 21
ASCII (ISOLATIN1) character string, 13 menu item, 17
soft key, 22
B types of, 20
Dialog resource
BREW Applet Resource file (BAR file), 9, 11, 38 creating, 17
BREW features, how to request new ones, 6 description, 8
BREW Resource header file (See RES.H file), 9 Documentation set, 6
BREW Resource Intermediate file (BRI file), 9, 38 dwParam, double-word parameter, 27
Dynamic-link library file (DLL file), 10, 11
C
Clock control E
description, 8 Emulator, 11
how to use, 32 EndDialog function, 17
Compiling Resource files, 39 EVT_COMMAND command, 27
Control Flags fields, 25
Control type descriptions, 8
Countdown control F
description, 9 File formats, BAR, BRI, _RES.H, 9
how to use, 33
CreateDialog function, 11, 17
Creating I
dialog resources, 17 Icon view control
image resources, 15 description, 9
interface for date display and entry, 30 when to use, 23
interface for text entry, 35 IDateCtl interface, 17
interface for time display and entry, 33 Image resource
menu, 24 creating, 15
string resources, 13 description, 8
dialog box, 15
D IMenuCtl, interface, 17
IShell interface, 11, 17
Date control ISOLATIN1 (ASCII) character string, 13
description, 8 ITextCtl interface, 17
how to use, 29 ITimeCtl interface, 17
Date display and entry control
date control, 29
date pick control, 29 L
how it functions, 17 LIB file, 11
types of, 28 List control
Date pick control description, 8
description, 8 when to use, 23
how to use, 29
40
Index
41