Graphical Objects and Images in Forms

Forms can contain graphical objects and images. Graphical objects are rectangles, lines or ellipses. Graphical objects are used to structure forms and, thus, make them easier to understand. Images are graphics files of the formats BMP, GIF (only not animated), JPG, WMF and ICO. They can be displayed both statically or dynamically (i.e. depending on the current record). In order to create graphical objects and to display images the following methods can be used:


Graphical Objects (via Field Title)

Graphical objects in forms are defined with the help of the macro @OBJBBS. This is done either mask-independently in the field Field Title of the field master or mask-specifically in the field Title-M of the mask-field-default relation. Replace the placeholders OBJ, B and BS in the macro with the following entries:

Placeholder Entry
OBJ -> Object Kind of graphical object:
RECT -> Creates a rectangle
CIRC -> Creates an ellipse
LINE -> Creates a line
B -> Border Line width for the border line of the graphical object in pixels
(for OBJ = LINE line width only)
BS -> Border Style Style for the border line of the graphical object:
SOLID -> Single line
BUMP -> Graphical object three-dimensional, embossed
HOLE -> Graphical object three-dimensional, engraved
DITCH -> Only border line three-dimensional, engraved
RIDGE -> Only border line three-dimensional, embossed.

For the special title definition you will use a separate auxiliary field. Create one in the field master (e.g. a database-independent calculation field). It is sufficient to create one auxiliary field. You can enter it in several masks and create different mask-specific graphical objects there. Because only the title definition is of interest, the auxiliary field itself should be made invisible. in the mask (mask-field relation, field A = empty). However, the latter does not apply for graphical objects in sub-forms. There the auxiliary field must be visible. Else the graphics would disappear as soon as the index tab is changed. They can only hide the auxilliary field by positioning it outside of the form.

You define the size of a graphical object via the title size in the fields L-Tit and W-Tit, the position relative to the auxiliary field in the fields R-Tit and C-Tit (mask-field-default relation). Length and width will create a rectangle or an ellipse. For horizontal lines you need L-Tit = 1, for vertical lines W-Tit = 1. The upper left corner of the graphical object is the origin for positioning.

Graphical objects are always in the background of forms. Thus normally displayed form fields are always visible in the foreground and are not covered.


Static Display of Images (via Field Title)

You statically display images in forms by entering the graphics file name using the form #file_name (e.g. #endoscope.bmp). You either do this mask-independently in the field Field Title of the field master or mask-specifically in the field Title-M of the mask-field-default relation. The field title automatically becomes the image window and displays the graphics referred to.

For the special title definition you will use a separate auxiliary field. Create one in the field master (e.g. a database-independent calculation field). It is sufficient to create one auxiliary field. You can enter it in several masks and create different mask-specific image windows there. Because only the title definition is of interest, the auxiliary field itself should be made invisible. in the mask (mask-field relation, field A = empty). However, the latter does not apply for images in sub-forms. There the auxiliary field must be visible. Else the images would disappear as soon as the index tab is changed. They can only hide the auxilliary field by positioning it outside of the form.

You define the size of an image window via the title size in the fields L-Tit and W-Tit, the position is relative to the auxiliary field in the fields R-Tit and C-Tit (mask-field-default relation). The size of the image window should correspond to the size of the image to be displayed. Cf. also -> Dimensioning Graphics in the row- and column grid. The upper left corner of the image window is the origin for positioning.

Image windows are always in the background of forms. Thus normally displayed form fields are always visible in the foreground and are not covered. This allows you for instance to display a full-size flow chart in the background and display planning data in fields on top of the graphics.

All required data are to be stored in a directory specified in the client environment variable DATAVIEW_CBMP.


Dynamic Display of Images (via Field Title)

You can display images depending on the current record, e.g. an image for an item in an item form. The dynamic display of images uses the same field title procedure like the -> static display of images. As opposed to that, however, the graphics file name in the field title is updated while browsing in the form at runtime. This is done by the standard userexit cch_set_tit at the Select_Action trigger of the form. You must install it there and provide the name of the auxiliary field as parameter. When the records are browsed, the userexit reads the current graphics file name from the auxiliary field and writes it to the title of the auxiliary field. The auxiliary field is not of secondary importance any longer. You must have created it as a regular table field (column) of the type S = String within the table to form points to. There the auxiliary field holds the name of the graphics file in the known form #file_name for each record. If an additional mask for entering the file name is available (e.g. an item list), you can make the auxiliary field invisible in the form.

For the dimensioning and positioning of the image window as well as for the management of the images in an image directory the same rules apply like for -> static display of images.


Dynamic Display of Images (via BLOB Field)

In BLOB fields you can directly store binary files (including graphics files) in the database. If the form contains such a BLOB field, DataView displays the contained graphics files directly and automatically in the BLOB field.

First observe the rules for -> BLOB fields. Extend the desired table by the BLOB field and enter the field into the mask. Then install a function (menu item, button or event) at the form using the standard menu userexit cch_sel_blb and pass the name of the BLOB field as parameter to the userexit. The function opens a file selection window, allows you to select a binary file there and writes it into the BLOB field of the record displayed.

If a graphics file was selected and stored in this way, this graphics will automatically displayed in the BLOB field of the form. If no graphics file can be found in the database, a default graphics can be displayed. The default graphics must be in a server directory and the graphics file name must be entered as default assignment in the attribute field (path specification necessary).

It is a precondition for displaying the graphics in the BLOB field that the product of column width and row length is bigger than . In real applications the field size should correspond to the size of the graphics. Cf. also -> Dimensioning Graphics in the row- and column grid.