"fill"

Defines the type of filling for a graphics object. Various patterns and pictures can be used. The pattern is specified with a fill-pattern string which can be generated with the fill type selector.

Synopsis

setValue(string shape,"fill", "[Pattern type,[Parameter2,Parameter3,Parameter4]]");

shape.fill("[Pattern type,[Parameter2,Parameter3,Parameter4]]");

Parameters

Parameter Description
shape Name of the graphics object
Parameters of the fill-pattern string:
Pattern type "solid" - object filled with color
"outline" - only object outline is visible
"pattern" - picture is loaded into the object
"hatch" - object filled with a hatching
"gradient" - object filled with a color gradient
Modifying parameters for the "pattern", "hatch" and "gradient" patterns:
Parameter 2

"pattern": pattern type:

  • "fit" - scaled
  • "tile" - arranged side-by-side (not usable in buttons)
  • "center" - center (only table cells)
  • "fit_keep_ratio" - scaled, with original image ratio (only available for vector graphics on push buttons)
  • "fit_keep_ratio_center" - same as "fit_keep_ratio" and in addition centered.

"hatch": Hatching type:

  • "cross" hatching
  • "parallel" hatching

"gradient" : Gradient type:

  • "linear" gradient fill
  • "radial" gradient fill
  • "conical" gradient fill
Parameter 3

"pattern" - Picture type:

The file type is recognized automatically. The keyword "any" is used and set automatically by the fill type selector.

"hatch" - Grid spacing:

obsolete parameter, the grid spacing is a fixed value

"gradient" - Spread:

  • "pad" gradient fills object once
  • "repeat" gradient is repeated
  • "reflect" gradient is repeated in inverted order
Parameter 4

"pattern" - File name:

<picture path>filename File path for the picture

"hatch" - orientation

  • left
  • right
  • horizontal
  • vertical

"gradient" - orientation:

A string of parameters defining color and orientation of the gradient. This is most comfortably set with the fill type selector.

Description

This function loads the pattern defined in the fill-pattern string to a graphics object or button. The string can be generated with the fill type selector.

The patterns "solid" and "outline" only use the pattern parameter and utilize the colors defined in the "backCol" and "foreCol" properties.

The patterns "pattern", "hatch" and "gradient" use different values for the parameters 2, 3 and 4. These are more closely defined in the fill-pattern string.

The fill-pattern string must not contain any spaces. Spaces after commas, for instance, will mask the associated parameter.

In case of primitive graphics objects (polyline, border, arc, ellipse) and buttons, a picture saved in a pixelformat is grayed out automatically when the object is disabled. However,vector formats are not changed when the object is disabled.

Please note that an absolute path is required to use a picture without being cached, e.g.: this.fill="[pattern,[tile,any," + getPath(PICTURES_REL_PATH, "Automation/camera.wmf") + "]]";

When using a relative path the picture is separately cached for each panel.

Example

A picture is loaded into a button, first setValue() is used, then the dot notation.

main()
{
  setValue("Button2", "fill","[pattern,[tile,any,auto.xpm]]");
}
main()
{
  this.fill("[pattern,[tile,any,http/login.gif]]");
}

Example

A rectangle is filled with inclined cross-hatching:

main()
{
  setValue("rectangle1", "fill", "[hatch,[cross,,right]]");
}

Assignment

Button, Frame, Polygon, Arc, Ellipse, Rectangle

Availability

UI