![]() UJML Language Reference |
The _x_loadBag() function loads a property bag and returns a boolean value indicating success or failure.
boolean _x_loadBag(string bagName)
|
Parameters |
Description |
|
bagName |
The name of a property bag to load |
The _x_loadBag() function returns a boolean value of true indicating success or false indicating failure.
This function retrieves a property bag into device memory from the device's persistent store. See Property Bag Functions. If the property bag does not exist it is created. Once loaded you may use other property bag functions to retrieve values, set values, remove values, and store the modified property bag. You should always use the _x_closeBag() function to close a property bag when it is no longer needed. See _x_closeBag() function.
A property bag may not be read, written to, or used in any way until it has been opened by calling _x_loadBag().
The following example shows how to get values from a property bag. It is part of the visualelements.ujml sample.
if (_x_loadBag("&BAG_NAME;"))
{
mSingleLineText =
_x_getBagString("&BAG_NAME;", &BAG_LABEL_TEXT;, mDefaultLabelText);
mMultiLineText =
_x_getBagString("&BAG_NAME;", &BAG_MULTI_LABEL_TEXT;, mDefaultMultiLabelText);
mFontStyleBold =
_x_getBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_BOLD;, false);
mFontStyleItalic =
_x_getBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_ITALIC;, false);
mFontStyleUnderlined =
_x_getBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_UNDERLINED;, false);
mFontStyleOutlined =
_x_getBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_OUTLINED;, false);
mFontSize =
_x_getBagInt("&BAG_NAME;", &BAG_FONT_SIZE;, &DEFAULT_FONT_SIZE;);
mFontFace =
_x_getBagInt("&BAG_NAME;", &BAG_FONT_FACE;, &DEFAULT_FONT_FACE;);
mForeColor =
_x_getBagInt("&BAG_NAME;", &BAG_FORE_COLOR;, &DEFAULT_FORE_COLOR;);
mBackColor =
_x_getBagInt("&BAG_NAME;", &BAG_BACK_COLOR;, &DEFAULT_BACK_COLOR;);
mOpacity =
_x_getBagInt("&BAG_NAME;", &BAG_OPACITY;, &DEFAULT_OPACITY;);
_x_closeBag("&BAG_NAME;");
}
else
{
&SET_SHARED_VARIABLE_DEFAULTS;
}
The following example shows how to set values into a property bag. It is part of the visualelements.ujml sample.
if (_x_loadBag("&BAG_NAME;"))
{
_x_setBagString("&BAG_NAME;", &BAG_LABEL_TEXT;, mSingleLineText);
_x_setBagString("&BAG_NAME;", &BAG_MULTI_LABEL_TEXT;, mMultiLineText);
_x_setBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_BOLD;, mFontStyleBold);
_x_setBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_ITALIC;, mFontStyleItalic);
_x_setBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_UNDERLINED;, mFontStyleUnderlined);
_x_setBagBoolean("&BAG_NAME;", &BAG_FONT_STYLE_OUTLINED;, mFontStyleOutlined);
_x_setBagInt("&BAG_NAME;", &BAG_FONT_FACE;, mFontFace);
_x_setBagInt("&BAG_NAME;", &BAG_FONT_SIZE;, mFontSize);
_x_setBagInt("&BAG_NAME;", &BAG_FORE_COLOR;, mForeColor);
_x_setBagInt("&BAG_NAME;", &BAG_BACK_COLOR;, mBackColor);
_x_setBagInt("&BAG_NAME;", &BAG_OPACITY;, mOpacity);
_x_storeBag("&BAG_NAME;");
_x_closeBag("&BAG_NAME;");
}|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|