2.9.12 Picture and Sound Controls

The purpose of image and sound controls is to show an image or a video file or to play a sound file.


Use the image control to display an image file. When the image you want to display is not enrolled in the repository, use the FileName property to display the name of the image file and when you want to display a repository-enrolled bitmap, use the Image property. Images that rarely change should be stored in the repository so that they are easier to find and manage. The image control can also display animations (animated .gif files).

The Visual LANSA installation CD has a directory VLRES that contains .gif and .bmp files you can use. You can also copy any image on the Internet by selecting it, right-clicking to bring up a popup menu and using the Save Image As… option. However, if you are using these images in commercial applications, make sure you are not infringing any copyrights.


Use the video control to display a video file.

The name of the video file is specified using the FileName property.

Video Panel

Use a video panel control to display a video file and to let the user play, pause and wind the video.


Use a sound control to play a sound file.

Specifying the File Name for Pictures and Sound

The image, video or sound file to be displayed in a control is specified using the FileName property. You can, of course, specify the full path where the file is stored, but this can easily cause problems when running the application on another workstation.

A better way of specifying the file name is to use a system variable for the path name. For example you could create a variable *VIDEOPATH and set its value to the path where you have stored the videos. You could then change the value of the variable as required:

define field(#FileName) type(*char) length(70)

use tconcat (*Videopath MyVideo.avi) (#FileName)

set #video_1 filename(#FileName)

Alternatively you could use one of the standard LANSA system variables such as *SYS_DIR to specify the path. For example if the file was installed in a directory PICTURES in the LANSA root directory (x:\X_Win95\X_LANSA), you could specify:

use tconcat (*SYS_DIR PICTURES\MyVideo.avi) (#FileName)

set #video_1 filename(#FileName)