Skip to content

AddImageType - cCJCommandBarSystem

Adds an image of the passed type to the CommandBar's imagelist

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
bIsIcon Boolean If True, image is an icon. If false, image is a bitmap
sImage String Relative name of image to be found in filepath or resource.
iId Integer Unqiue integer identifier. If zero, the ID will be auto assigned.
eImageType Integer Type of ImageConstantMeaning

Syntax

Function AddImageType Boolean bIsIcon String sImage Integer iId Integer eImageType Returns Integer

Call Example

Get AddImageType bIsIcon sImage iId eImageType to IntegerVariable

Description

AddImageType adds an image of the passed type to the CommandBar's imagelist. The image type is determined by the file extension in the passed image name: .bmp, .ico, .jpg, .png, .gif are all supported.

The Id passed must be a unique identifier for the image. Alternately, if you pass a zero for the ID, the ID will be automatically assigned and its value returned.

The image name must be a relative name (i.e., "MyImage.ico" and not "c:\MyApp\Bitmaps\MyImage.ico"). The message will first attempt to find the image in the program's resource area. If not found, it will search your program's dfpath for the filename. If the file cannot be found in the resource or in a filepath, the image will not be added and zero will be returned.

This is identical to AddImage except that Addimage will auto-detect the image type (Icon or Bitmap) based on the filename extentsion.

// add an icon, auto assign the id
Get AddImageType True "MyImage.ico" 0 xtpImageNormal to iId
If (iId=0) Begin
   // image was not added 
End

Note

This message is normally not used to add images. The cCJAction methods psImage, psImageHot, psImageDisabled, psImageChecked, and psImagePressed are typically used for this.

Image Mask Color

The image mask color determines how the various image states (normal, disabled, hot, etc.) are rendered. This data is provided in icon files. With bitmap files this color is determined by using the image's top left corner.

Return Value

If successful, this returns the ID of the image. If not successful, this returns zero.