GUI ScreenIO for Windows

 ScreenIO.com


How to Use Image Controls in Your Program

Your COBOL field definitions reside in the -4 portion of the panel copybook.  For an image control, the field definition is always PICTURE X(length), where you define the length when you defined the control in the editor.

 01 panel-4.
      .
      .
     05 MY-IMAGE-CONTROL     PIC X(255).

To load an image from a file :

     MOVE my-image-filespec TO MY-IMAGE-CONTROL.

If you have stored a bitmap image resource in your application (as we have for the GUI ScreenIO splash screen you see when you launch the panel editor, you load it by prefacing the name with a HIGH-VALUE, like this:

     STRING HIGH-VALUE
            'myimage' DELIMITED SIZE INTO MY-IMAGE-CONTROL.

Now, call GUI ScreenIO to display your panel.  If the image file is found, it'll be displayed.

For example, you could do this:

     MOVE 'GUISCRIO.BMP' TO MY-IMAGE-CONTROL.

and (assuming GUISCRIO.BMP is in the current directory), your image control will load this image:

You can also specify that your image control will return an event if it's clicked.  This is evaluated using an 88-level item, like any other event would be.

CAUTION

Always use a complete path specification to your images.  Some Windows APIs navigate away from the current directory, and when GUI ScreenIO next needs to load your image file it will not find it if you use a simple file name such as "my-image.jpg".  This will not be a problem if you use a complete path spec such as C:\\mydata\images\mh-image.jpg or \\server\share\images\my-image.jpg.  Typically, you would want to locate standard images in the same directory as your .EXE or in a subordinate directory.  Then you can use the facilities of your COBOL compiler to find the directory containing your .EXE file (this varies by compiler) and use that to build all image file path specs.

Related topics:


2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom