Screen Builder Picture Objects


 

A picture object can be dropped onto a screen in order to display an image. You are able to control the position, size and cropping of the image. You can also assign, via CAPITAL Business Script, where image files are located and under what circumstances they should be displayed.

generate/hint1.gifCAPITAL Office only supports standard Windows bitmap images and JPEG files. If your graphic files are stored in a different format, such as TIFF or GIF you must convert the image to Windows bitmap format (BMP) or JPEG (JPG) before CAPITAL will be able to display it properly. You may need to obtain a third-party graphic file format translation tool in order to do this.

generate/mouse1.gif To insert a picture on the screen click on the generate/instpic1.gif toolbar button. Move the mouse to where you want to place the image and left click once. To position and size the object point to the image and hold down the left mouse button and move the mouse. Release the mouse button when the image is where you want to place it.

If you want to resize the image click on the image once to select it. Move to any corner of the image and hold down the left mouse button and drag the mouse.

You can also double-click on the picture object to change its property settings.

When you create or edit a picture object you will be prompted for one of two choices:

Scale the image to fit entirely within the picture

If this choice is selected the image will be scaled to fit into the area you have provided for it. CAPITAL uses standard Windows painting and scaling functions to fit the image into the area you have assigned it, so the quality of the resulting image will be determined by such things as:

If your images do not show up acceptably you may wish to consider scaling them in a third-party graphics package before giving them to CAPITAL to scale.

Show actual size of image (no scaling)

No attempt is made to scale the graphic image if this option is selected. If the graphic image does not fit in the space provided for it, those areas that do not fit are cropped.

generate/mistake1.gifImages of around 50-300K display best. Very large images may hurt performance.

Bitmap (BMP) images will display faster than JPEG (JPG) images on certain computers. JPEG images are stored in a compressed file format and must be decompressed before they can be displayed. Very large images on slower computer hardware may result in unacceptable delays when displaying images. You will need to either increase the speed of your hardware or reduce the size of the images CAPITAL is expected to display. (This will require the use of a third-party graphic tool to reduce the complexity of the image.)

Each CAPITAL screen can display up to 100 picture objects.

generate/cbs2.gif Assigning a Graphic File to a Picture Object

When you click on the Formula tab of a picture object the following two variables appear in the Editor box ready for you to assign values to them:

PictureLocation :=

PictureFileName :=

The first variable is used to specify the directory where the image file is to be found. The second variable is the name of the image file.

In the following example bitmap files are stored in the directory F:\PICS and the image to display is House.bmp:

PictureLocation := "F:\PICS"

PictureFileName := "House.bmp"

It is also possible to display different images subject to certain conditions or values in your database. An image might be matched against the contents of a standard CAPITAL screen field, such as a product code or stock ID, or perhaps a customer or supplier code.

Alternatively, it might relate to a user defined field. For example, an asset register database may have in it a user defined field that refers to an image file. Assuming that this field was called 'Image' a possible script might take this format:

PictureLocation := "F:\PICS"

PictureFileName := SCRRead("Image")

The above script does the following:

  1. Line 1 assigns the directory location of the picture file to F:\PICS

  2. The contents of the field Image is read from the screen using the SCRRead function and assigned to the variable PictureFileName. Unless a file extension is specified, the default filename assumed is .BMP.

 If you wanted to display JPEG images the scripting would be:

If .Not. IsEmpty(SCRRead("Image"))

   PictureLocation := "F:\PICS"

   PictureFileName := Alltrim(SCRRead("Image")) + ".JPG"

Endif

The above script does the following:

  1. Line 1 checks to see if the contents of the field Image is empty. The location and name variables are only assigned values if Image has a name in it.

  2. Line 2 specifies the directory location where images are stored.

  3. Line 3 uses the Alltrim() function to remove all leading and trailing spaces and then adds the ".JPG" extension onto the name of the Image. So if the image name was "House" the file name would be: "House.jpg"

The next script tries to match an image file against a stock ID. Stock ID's are particularly handy to use for this purpose as they are short (7 digits) and always unique per product. They also do not contain any characters that Windows would object to in a file name:

Declare MyPicture Type Character

MyPicture := StockID() + ".BMP"

PictureLocation := "C:\PICS"

If IsFile(PictureLocation + "\" + MyPicture)

   PictureFileName := MyPicture

Endif

The above script does the following:

  1. Line 1 declares a temporary variable called MyPicture.

  2. Line 2 assigns this temporary variable the stock ID number using the StockID() function and adds the file extension ".BMP" to the end of it. So if the Stock ID was 0000010, the expected file name would be "0000010.BMP"

  3. The 3rd line specifies the pictures directory as C:\PICS

  4. The IsFile() function is used to determine whether the image exists before assigning it to the variable PictureFileName. If the image does not exist and the variable PictureFileName is assigned a value anyway, CAPITAL will display a warning message. This could get annoying, so the script checks to see if such an image exists first.

  5. Line 5 assigns MyPicture - which now hold's the file name - to the CAPITAL picture variable.

generate/hint1.gifFor more information on scripting syntax and functions consult the Visual Builder Reference Guide or on-line help.



Help Topic Map