Follow these steps to store a path to the image, instead of the image itself.

  1. Create a linear hash table called PICTEST  with two fields, one called NAME, and the other called PICTURE, as shown below:

  2. Create a form (called IMGEXAMPLE) based on the PICTEST table. Resize the form to make it longer and add a bitmap control (BITMAP_1). The form should look similar to the example below:
     

  3. In the Changed event of the PICTURE control type in this script:

    pathToBitmap = Get_Property( @window : '.PICTURE', 'TEXT')
    path = Set_Property( @window : '.BITMAP_1', 'BITMAP', pathToBitmap)

    This will change the image whenever the contents of the PICTURE control (the path to the image) changes. If the path points to an invalid image file, or the file does not exist, the OpenInsight default image displays. In other words it is a good idea to ensure the path is valid.

    Below is a sample display of a valid image (in this case a JPEG file) using this form:

     

  4. Run the form and add records. Verify that the images are associated with the correct records.

This method relies on the user entering the correct path in the PICTURE control. A more reliable method is to use a dialog box instead. The next topic shows how this is done.

  • No labels