UIEvolutin Inc.
UJML Language Reference
_resizeArray()

This function resizes an array variable.

UJML Script Syntax
void _resizeArray(arrayref arrayVariable, int dimensionCount, ...);
Parameters 
Description 
arrayVariable 
The name of an array variable. See Arrays
dimensionCount 
The number of elements for one dimension of the array, repeated as needed for each dimension of the array. The value must be 1 or greater, unless all dimensions are 0. 

This function has no return value.

This function changes the count of elements for each dimension of an array variable. See Arrays. You must pass a count value for each dimension of the array you are resizing. 

Note: You cannot resize a state variable array. 

Note: The array must be declared with a count of 0 for each dimension. 

The array variable to be resized must be a standard variable (not a state variable) declared with a 0 count for each dimension of the array. When resizing an array, you must provide a count of 1 or greater for each dimension of the array or provide a count of 0 for all dimensions of the array (which has the effect of clearing the array variable and setting it to the array variable's initial state). You cannot resize an array with a mix of zero and non-zero dimension counts and you cannot provide negative dimension counts. 

Note: Until you resize the array variable you cannot use it in an expression or set the value of an element.

When an array is resized, existing array element values are not affected. This means that an array of ten elements which is resized to five elements will contain the same values in elements 0 to 4 that it contained before the resize operation. If the same ten element array is resized to twenty elements, then elements 0 to 9 contain the same values they had before the resize operation and elements 10 to 19 will contain default initial values for the data type of the array.

The following example declares a one dimensioned variable which can be resized. It is part of the timer.ujml sample.

<var name="mListeners" type="ITimerListener" size="0"/>

 

The following example shows how to resize the array variable declared above. It is part of the timer.ujml sample.

_resizeArray(mListeners, maxListeners);

 

The following example declares a two dimensioned variable which can be resized. It is part of the lifegrid.ujml sample.

<var name="mBlocks" type="ILifeBlock" size="0, 0"/>

 

The following example shows how to resize the array variable declared above. It is part of the lifegrid.ujml sample.

_resizeArray(mBlocks, mRows, mCols);
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!