Language Reference Guide : System Classes : BitmapObject Class : ImageIndex Attribute
 
Share this page          
ImageIndex Attribute
Data Type: integer
4GL Access: R
The ImageIndex attribute is the 1-based index of the current image in this BitmapObject.
This attribute is for use with field BgBitmap displays. If the BitmapObject referenced by the BgBitmap attribute has multiple images, the ImageIndex determines which of them will be displayed as the field's background, enabling highlighting and animation and state-change-switching effects to be implemented simply:
On click statuschangebtn =
{
    iid = myField.BgBitmap.ImageIndex;
    case iid of
    1:  newiid = 4;
    2:  newiid = 1;
    3:  newiid = 2;
    4:  newiid = 3;
    default:  newiid = 4;
    endcase;
    myField.UpdBackground(imageindex=iid);
    callframe NextStep(status=iid);
}
For more information about using ImageIndex in codeless implementations of these features, see the InputEvent class LoadEventBehavior Method.
This attribute is read only: attempting to change the current image by direct assignment to this attribute will have undefined results. Instead, use the ImageIndex parameter in FormField.UpdBackground() (see UpdBackground Method) to change which image is current.
Note:  The attribute is 1-based. A value of 0 is possible but is treated as a value of 1. So the following code may have unintended results:
if myBitmap.ImageIndex = 1 then
Use instead:
if myBitmap.ImageIndex = 0 or myBitmap.ImageIndex = 1 then
The ImageIndex attribute is not saved when a BitmapObject is saved. Created or duplicated BitmapObjects have an ImageIndex of 0.