Images: Displaying Images

Images can be displayed on a canvas inside TRIM windows or in a browser.
Images: Displaying in Browser Windows
Images: Displaying in TRIM windows

Images: Displaying in TRIM windows [UNDER CONSTRUCTION]


Images: Displaying in TRIM windows

An image canvas can be created in a window with other alphanumeric fields, or in a separate window that displays only the bitmap. The image canvas is actually a Graphics List which can be created by following these steps. This example displays a chemical structure in a separate TRIM window which changes each time the current SMILES in the calling window changes.
  1. Create a sibling window called structure and display it in the GUI developer. Right click the spot for the location of the new image. From the drop down menu, select 'Create' and then 'List' to get the 'Define List' Dialog Box. Complete the Dialog Box by entering the name of the list, setting the size of the image canvas, choosing List Type Graphics and clicking OK.
  2. Assign *.bmp file to the variable 'theimage.bmp' and create a list. This might be done in a user trigger as follows:
    {
    /* STRUCTURE() creates a Graphic List */
    list ll;
    file_copy("c:\trifox\cache\228277b.bmp","gui!image:theimage.bmp");
    ll = list_open("60",1);
    list_mod(ll,1,"0 8   0   0 9999 9999 THEIMAGE");
    return(ll);
    }
    
    The space delimited string "0 8 0 0 9999 9999 THEIMAGE" defines the chracteristics of the image canvas and reading left to right:
    • 0 is the window ID
    • 8 defines the list as Type Graphics
    • 0 is width of image*
    • 0 is height of image*
    • 9999 is the 'x' position of the canvas
    • 9999 is the 'y' position of the canvas
    • 'THEIMAGE' is the filename of the bitmap image
    • *If width & height are 0, the area of the bmp equals that of the bitmap file itself.

  3. Control the structure window from the SMILES field of the calling window using this code.
    ...
    struct.structure = structure();  /* create graphics list;assign it to struct.structure */
    window(struct,open);
    list_view2(struct.structure,-1,-1,-1,0);
    
    Finally, set the user attributes in the SMILES field of the calling window to 'Calculate' (right click SMILES field to get Define Field Dialogue, click Attributes and select Calculate). With 'Calculate' on the field trigger for SMILES will be executed and the structure for the new SMILES will be displayed.