ScriptUIGraphics
An object used to draw custom graphics, found in the graphics property of window, container, and control objects.
Allows a script to customize aspects of the element's appearance, such as the color and font. Use an onDraw callback function to set these properties or call the functions.All measurements are in pixels.
QuickLinks
Properties
Property | Type | Access | Description |
---|---|---|---|
backgroundColor | ScriptUIBrush | r/w | The background color for containers; for non-containers, the parent background color. The paint color and style is defined in this brush object. |
currentPath | ScriptUIPath | readonly | The current drawing path, encapsulated in a path object. |
currentPoint | Point | readonly | The current position in the current drawing path. |
disabledBackgroundColor | ScriptUIBrush | r/w | The background color for containers when disabled or inactive; for non-containers, the parent background color. The paint color and style is defined in this brush object. |
disabledForegroundColor | ScriptUIPen | r/w | The text color when the element is disabled or inactive. The paint color and style is defined in this pen object. |
font | ScriptUIFont | r/w | The default font to use for displaying text. |
foregroundColor | ScriptUIPen | r/w | The text color. The paint color and style is defined in this pen object. |
Class
Property | Type | Access | Description |
---|---|---|---|
BrushType | Object | readonly |
Contains the enumerated constants for the type argument of newBrush().
Type constants are: SOLID_COLOR, THEME_COLOR. |
PenType | Object | readonly |
Contains the enumerated constants for the type argument of newPen().
Type constants are: SOLID_COLOR, THEME_COLOR. |
Methods
Instances
void closePath ()
Closes the current path.
Defines a line from the current postion (currentPoint) to the start point of the current path (the value of currentPath).
void drawFocusRing (left:
Number, top:
Number, width:
Number, height:
Number)
Draws a focus ring within a region of this element.
Parameter | Type | Description |
---|---|---|
left | Number | The left coordinate of the region. Value is relative to the origin of this element. |
top | Number | The top coordinate of the region. Value is relative to the origin of this element. |
width | Number | The width of the region in pixels. |
height | Number | The height of the region in pixels. |
void drawImage (image:
ScriptUIImage, left:
Number, top:
Number[, width:
Number][, height:
Number])
Draws an image within a given region of the element.
Uses the version of the image that is appropriate to the element's current state.
Parameter | Type | Description |
---|---|---|
image | ScriptUIImage | The image to draw. This object contains different versions of an image appropriate to various element states, such as a dimmed version for the disabled state. |
left | Number | The left coordinate of the region, relative to the origin of this element. |
top | Number | The top coordinate of the region, relative to the origin of this element. |
width | Number | The width in pixels. If provided, the image is stretched or shrunk to fit. If omitted, uses the original image width. (Optional) |
height | Number | The height in pixels. If provided, the image is stretched or shrunk to fit. If omitted, uses the original image height. (Optional) |
void drawOSControl ()
Draw the platform-specific control associated with this element.
void drawString (text:
String, pen:
ScriptUIPen, x:
Number, y:
Number[, font:
ScriptUIFont])
Draw a string of text starting at a given point in this element, using a given drawing pen and font.
Parameter | Type | Description |
---|---|---|
text | String | The text string. |
pen | ScriptUIPen | The drawing pen to use. |
x | Number | The left coordinate, relative to the origin of this element. |
y | Number | The top coordinate, relative to the origin of this element. |
font | ScriptUIFont | The font to use. Default is the font value in this object. (Optional) |
Point ellipsePath (left:
Number, top:
Number, width:
Number, height:
Number)
Defines an elliptical path within a given rectangular area in the currentPath object, which can be filled using fillPath() or stroked using strokePath().
Returns a Point object for the upper left corner of the area, which is the new currentPoint.
Parameter | Type | Description |
---|---|---|
left | Number | The left coordinate of the region, relative to the origin of this element. |
top | Number | The top coordinate of the region, relative to the origin of this element. |
width | Number | The width of the region in pixels. |
height | Number | The height of the region in pixels. |
void fillPath (brush:
ScriptUIBrush[, path:
ScriptUIPath])
Fills a path using a given painting brush.
Parameter | Type | Description |
---|---|---|
brush | ScriptUIBrush | The brush object that defines the fill color. |
path | ScriptUIPath | The path object. Default is the currentPath. (Optional) |
Point lineTo (x:
Number, y:
Number)
Adds a path segment to the currentPath.
The line is defined from the currentPoint to the specified destination point. Returns the Point object for the destination point, which becomes the new value of currentPoint.
Parameter | Type | Description |
---|---|---|
x | Number | The X coordinate for the destination point, relative to the origin of this element. |
y | Number | The Y coordinate for the destination point, relative to the origin of this element. |
Dimension measureString (text:
String[, font:
ScriptUIFont][, boundingWidth:
Number])
Calculates the size needed to display a string using the given font.
Returns a Dimension object that contains the height and width of the string in pixels.
Parameter | Type | Description |
---|---|---|
text | String | The text string to measure. |
font | ScriptUIFont | The font to use. Default is the font value in this object. (Optional) |
boundingWidth | Number | The bounding width. (Optional) |
Point moveTo (x:
Number, y:
Number)
Adds a given point to the currentPath, and makes it the current drawing position.
Returns the Point object which is the new value of currentPoint.
Parameter | Type | Description |
---|---|---|
x | Number | The X coordinate for the new point, relative to the origin of this element. |
y | Number | The Y coordinate for the new point, relative to the origin of this element. |
ScriptUIBrush newBrush (type:
Number, color:
Array of Number | String)
Creates a new painting brush object.
Parameter | Type | Description |
---|---|---|
type | Number | The brush type, solid or theme. One of the constants ScriptUIGraphics.BrushType.SOLID_COLOR or ScriptUIGraphics.BrushType.THEME_COLOR. |
color | Array of Number | String | The brush color. • If type is SOLID_COLOR, the color expressed as an array of three or four values, in the form [R, B, G, A] specifying the red, green, and blue values of the color and, optionally, the opacity (alpha channel). All values are numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque. • If the type is THEME_COLOR, the name string of the theme. Theme colors are defined by the host application. |
ScriptUIPath newPath ()
Creates a new, empty path object.
Replaces any existing path in currentPath.
ScriptUIPen newPen (type:
Number, color:
Array of Number | String, width:
Number)
Creates a new drawing pen object.
Parameter | Type | Description |
---|---|---|
type | Number | The pen type, solid or theme. One of the constants ScriptUIGraphics.PenType.SOLID_COLOR or ScriptUIGraphics.PenType.THEME_COLOR. |
color | Array of Number | String | The pen color. • If type is SOLID_COLOR, the color expressed as an array of three or four values, in the form [R, B, G, A] specifying the red, green, and blue values of the color and, optionally, the opacity (alpha channel). All values are numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque. • If the type is THEME_COLOR, the name string of the theme. Theme colors are defined by the host application. |
width | Number | The width of the pen line in pixels. The line is centered around the current point. For example, if the value is 2, drawing a line from (0, 10) to (5, 10) paints the two rows of pixels directly above and below y-position 10. |
Point rectPath (left:
Number, top:
Number, width:
Number, height:
Number)
Defines a rectangular path in the currentPath object.
The rectangle can be filled using fillPath() or stroked using strokePath().Returns the Point object for the upper left corner of the rectangle, which becomes the new value of currentPoint.
Parameter | Type | Description |
---|---|---|
left | Number | The left coordinate relative to the origin of this element. |
top | Number | The top coordinate relative to the origin of this element. |
width | Number | The width in pixels. |
height | Number | The height in pixels. |
void strokePath (pen:
ScriptUIPen[, path:
ScriptUIPath])
Strokes the path segments of a path with a given drawing pen.
Parameter | Type | Description |
---|---|---|
pen | ScriptUIPen | The drawing pen that defines the color and line width. |
path | ScriptUIPath | The path object. Default is the currentPath. (Optional) |
Element of
Button.graphics
Checkbox.graphics
DropDownList.graphics
EditText.graphics
Group.graphics
IconButton.graphics
ListBox.graphics
Panel.graphics
Progressbar.graphics
RadioButton.graphics
Scrollbar.graphics
Slider.graphics
StaticText.graphics
TreeView.graphics
Window.graphics
Jongware, 20-Jun-2010 v3.0.3d | Contents :: Index |