Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

28    Resource Loading Reference

User Interface

Exploring Palm OS®

This chapter provides reference material for the resource loading API defined in the header file UIResources.h.

Resource Loading Functions and Macros ^TOP^

ResLoadConstant Function ^TOP^

Purpose

Loads a constant from a 'tint' resource and returns its value.

Declared In

UIResources.h

Prototype

uint32_t ResLoadConstant (
   DmOpenRef database,
   DmResourceID rscID
)

Parameters

database
Open database containing the resource.
rscID
The ID of the 'tint' resource (symbolically named constantRscType) to load.

Returns

The four-byte value of the constant in the resource, or 0 if the resource could not be found. The return value may be cast as necessary.

Comments

Use this function to load "soft constants"—constant values that are stored as 'tint' resources. (All open resource databases are searched for the resource ID you specify.) You should store a constant value as a resource when its value changes depending on the locale.

As an example, consider the maximum length of the Alarm Sound trigger label in the Datebook application's preferences panel. The list displayed by this trigger uses the localized name for each sound stored in the system. Because localized names are used, the maximum length that the Datebook application allows for the label differs depending on the current locale. The maximum length is stored as a resource constant so that each overlay database can specify a different value for the constant.

See Also

DmGetResource()

ResLoadConstantV50 Function ^TOP^

Purpose

Loads a constant from a 'tint' resource and return its value.

Declared In

UIResources.h

Prototype

uint32_t ResLoadConstantV50 (
   DmResourceID rscID
)

Parameters

rscID
The ID of the 'tint' resource (symbolically named constantRscType) to load.

Returns

The four-byte value of the constant in the resource, or 0 if the resource could not be found. The return value may be cast as necessary.

Compatibility

This function is provided for backward compatibility only. Use ResLoadConstant() instead.

ResLoadForm Function ^TOP^

Purpose

Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.

Declared In

UIResources.h

Prototype

FormType *ResLoadForm (
   DmOpenRef database,
   DmResourceID rscID
)

Parameters

database
Open database containing the resource.
rscID
The resource ID of the form.

Returns

A pointer to a FormType structure representing the form.

ResLoadFormV50 Function ^TOP^

Purpose

Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.

Declared In

UIResources.h

Prototype

void *ResLoadFormV50 (
   DmResourceID rscID
)

Parameters

rscID
The resource ID of the form.

Returns

The handle of the memory block that the form is in.

Compatibility

This function is provided for backward compatibility only. Use ResLoadForm() instead.

ResLoadFormWithFlags Function ^TOP^

Purpose

Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.

Declared In

UIResources.h

Prototype

FormType *ResLoadFormWithFlags (
   DmOpenRef database,
   DmResourceID rscID,
   WinFlagsType windowFlags
)

Parameters

database
Open database containing the resource.
rscID
The resource ID of the form.
windowFlags
Window attributes to use when creating the dialog. See WinFlagsType. The attribute winFlagModal is set for you.

Returns

A pointer to a FormType structure representing the form.

ResLoadMenu Function ^TOP^

Purpose

Copies and initializes a menu resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the menu.

Declared In

UIResources.h

Prototype

MenuBarType *ResLoadMenu (
   DmOpenRef database,
   DmResourceID rscID
)

Parameters

database
Open database containing the resource.
rscID
The resource ID of the menu.

Returns

A pointer to a MenuBarType structure containing the menus.

ResLoadMenuV50 Function ^TOP^

Purpose

Copies and initializes a menu resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the menu.

Declared In

UIResources.h

Prototype

void *ResLoadMenuV50 (
   DmResourceID rscID
)

Parameters

rscID
The resource ID of the menu.

Returns

The handle of the memory block that the menu is in.

Compatibility

This function is provided for backward compatibility only. Use ResLoadMenu() instead.

ResLoadString Function ^TOP^

Purpose

Loads a constant from a string resource and returns its value.

Declared In

UIResources.h

Prototype

char *ResLoadString (
   DmOpenRef database,
   DmResourceID rscID,
   char *strP,
   size_t maxLen
)

Parameters

database
Open database containing the resource.
rscID
The resource ID of the string.
strP
Upon return, the string parameter you pass in contains the contents of the string resource.
maxLen
The size in bytes of the strP parameter.

Returns

The strP parameter.