Cache

[property icon] Cache$

Specifies the cached server file name of the picture file

String property

Applies to: Picture Object


>Cache

Cache

Specifies the full server name of the picture object used by a KCML picture control. This property is the same as the Filename$ property except that filename used with cache$ should point to a picture file on the server rather than on the client. In general .cache$ should be used in preference to .filename$ to centralize the pictures in one place on the server.

On first reference the client will automatically download the picture from the server and cache it locally so that future executions of the program need not copy the file over the network to the client. The picture is identified in the cache with a signature which depends on its last modification time and a hash of its contents so that if the picture is updated on the server a fresh copy will be sent to the client when the picture is next referenced. Note that this signature is computed only once per picture per form instance and so if the picture is updated on the fly while a form is presented, it is not sufficient to set the .cache$ property reduntantly a second time in some form event handler; you must either close and reopen the form or use a different filename as the value of the .cache$ property.

Picture controls can be assigned to the form background, picture button controls, tree nodes and grid cells.

From KCML version 5.03 onwards it is possible to put environment variables in the cache filename. These are expanded at the server end to determine where the picture is located. e.g. "$PICTURE/menu/menu1.bmp". All sequences of a $ followed by alphanumeric characters up the the next '/' or the end of the filename are replaced by the value of the environment variable or an empty string if the variable is not defined.

 .Picture1.Cache$ = "../PictureFiles/BackGround.WMF"
 .Picture2.Cache$ = "$PICTURE/logo.jpg"

Here is an example program demonstrating the use of server pictures which can be pasted from the clipboard into a Workbench session. Don't be confused by the fact that the names are PC filenames as it is intended to be run against a Windows server. If you have some pictures on a Unix server then run against that and specify a Unix filename.

See also

Picture Object methods, properties and events.