ElementOptions class (Surface)

Surface.ElementOptions()

new ElementOptions()

The Surface.ElementOptions class holds all options an element can display or own.

Every option of the Surface.ElementOptions type has associated a property of the control. For instance, the option:

caption {string}, defines the element's caption
is associated with the property:
Caption {string}, defines the element's caption
which means that the following statements are equivalent:
oElement.Options = {caption: "name"}
oElement.SetOptions({caption: "name"})
oElement.Caption = "name"
oElement.SetCaption("name")
where oElement is an object of Element type
ElementOptions

Members

(static) autoSize :boolean

The autoSize field indicates whether the element's size is automatically computed based on its content.
Type:
  • boolean
Since:
  • 2.2
Example
true {boolean}, the element is automatically resized to fit its content
autoSize

(static) caption :string

The caption field defines the element's caption.
Type:
  • string
Example
null {null}, indicates no caption
 "caption" {string}, declares a plain-caption
 "<b>text</b>" {string}, displays the text in bold
 "<img>logo</img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method
caption

(static) client :Array.<number>

The client field defines the element's client area as an array of [x,y,width,height] type.
Type:
  • Array.<number>
Example
null {null}, defines an element quivalent with [0,0,32,32]
 [0,0,128,128] {number[]}, defines the element at the center of the control of 128 x 128 pixels size
client

(static) cursor :string

The cursor field defines the mouse-cursor for individual element.
Type:
  • string
cursor

(static) enabled :boolean

The enabled field indicates whether the element is enabled or disabled.
Type:
  • boolean
Example
false {boolean}, disables the element
 true {boolean}, enables the element
enabled

(static) expand :boolean

The expand field indicates whether the element is expanded or collapsed.
Type:
  • boolean
Example
false {boolean}, collapses the element
expand

(static) formatText :exontrol.DrawTextFormatEnum

The formatText field specifies the format to display the element's caption. The exontrol.DrawTextFormatEnum type support the following flags:
  • exTextAlignTop (0x00), justifies the text to the top of the rectangle
  • exTextAlignLeft (0x00), aligns text to the left
  • exTextAlignCenter (0x01), centers text horizontally in the rectangle
  • exTextAlignRight (0x02), aligns text to the right
  • exTextAlignVCenter (0x04), centers text vertically
  • exTextAlignBottom (0x08), justifies the text to the bottom of the rectangle.
  • exTextAlignMask (0x0F), specifies the mask for text's alignment.
  • exTextWordBreak (0x10), breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line. If this is not specified, output is on one line.
  • exTextSingleLine (0x20), displays text on a single line only. Carriage returns and line feeds do not break the line.
  • exTextExpandTabs (0x40), expands tab characters. The default number of characters per tab is eight.
  • exPlainText (0x80), treats the text as plain text.
  • exTextNoClip (0x0100), draws without clipping.
  • exHTMLTextNoColors (0x0200), ignores the and tags.
  • exTextCalcRect (0x0400), determines the width and height of the text.
  • exHTMLTextNoTags (0x0800), ignores all HTML tags.
  • exTextPathEllipsis (0x4000), for displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle. If the string contains backslash (\) characters, exTextPathEllipsis preserves as much as possible of the text after the last backslash.
  • exTextEndEllipsis (0x8000), for displayed text, if the end of a string does not fit in the rectangle, it is truncated and ellipses are added. If a word that is not at the end of the string goes beyond the limits of the rectangle, it is truncated without ellipses.
  • exTextWordEllipsis (0x040000), truncates any word that does not fit in the rectangle and adds ellipses.
.
Type:
  • exontrol.DrawTextFormatEnum
formatText

(static) image :string

The image field specifies the name of the image/picture the element displays. The image can be added using the exontrol.HTMLPicture.Add() method.
Type:
  • string
image

(static) imageAlign :number

The imageAlign field defines the alignment of the image within the element. The imageAlign propery can be any of the following:
  • 0, the image is on the left of the node's caption (default)
  • 1, the image is on the right of the node's caption
  • 2, the image is on the top of the node's caption
  • 3, the image is on the bottom of the node's caption
.
Type:
  • number
Example
null {null}, the image is on top of the node's cation (default value)
 1 {number}, the image is displayed to the left of the node's caption
imageAlign

(static) imageSize :null|number|Array.<number>

The imageSize field defines the size of the element's image. The imageSize could be of one of the following types:
  • {undefined}, Indicates that the control's imageSize option is considered, so the element's image is measured according to the control's imageSize option.
  • {null}, Indicates that the node's image is displayed as it is (full-sized).
  • {number}, Specifies that the node's image is displayed into a square of giving size (same width and height). If 0 the node displays no image, if negative the node's image is stretched to giving square, else the node's picture is scaled to fit the giving rectangle.
  • {number[]}, Specifies an array of [aspect-width,aspect-height] type that defines the limits for width or/and height. The aspect-width and aspect-height define the width/height of the node's picture to scale or stretch to.
.
Type:
  • null | number | Array.<number>
Example
null {null}, Indicates that the node's image is displayed as it is (full-sized).
 0 {number}, no image is displayed
 64 {number}, the image is scaled to fit a 64 x 64 rectangle
 -64 {number}, the image is strected to a 64 x 64 rectangle
 [32,64] {array}, scales the image to the largest ratio-rectangle (32 x 64) that fits the client
 [-32,-64] {array}, stretches the image to a 32 x 64 rectangle
imageSize

(static) key :string

The key field specifies the key associated with the element. If no key is provided, the element's plain-caption can be used to request an item. The plain-caption includes no ex-HTML tags, such as <b>, <fgcolor> and so on.
Type:
  • string
Example
"logo" {string}, defines the element with the giving key (logo). You can use the Root.Item("logo") method to request the element giving its key.
key

(static) movable :boolean

The movable field specifies whether the user can move the element, by drag and drop.
Type:
  • boolean
Since:
  • 2.2
Example
false {boolean}, the user can not move the element (by drag and drop)
movable

(static) pad :number|Array.<number>|string

The pad field defines the element's padding (space between the element's content and its border) A value that could be:
  • {number} a numeric value, to pad horizontal and vertical size with the same value,
  • {string|number[]} a "x,y" or [x,y] type to specify the padding on h/v size
.
Type:
  • number | Array.<number> | string
Example
null {null}, indicates that the default-padding field is used ([4,4])
  0 {number}, indicates no padding
  "8,4" {string}, increases the node's width with 2 * 8-pixels and node's height with 2 * 4-pixels
  [8,4] {array}, increases the node's width with 2 * 8-pixels and node's height with 2 * 4-pixels
pad

(static) parent :any

The parent field defines the element's parent. The parent field can be one of the following:
  • parent {number}, indicates a numeric value that defines the index of the parent's element (0-based)
  • parent {string}, specifies a string expression that defines the identifier/key/plain-caption of the parent's element
  • parent {Element}, specifies the object reference to the parent's element
.
Type:
  • any
Example
0 {number}, indicates that the element with the index 0 is the parent of the current element
 "key" {string}, specifies that the parent of the current element is the element with the giving key
parent

(static) position :number

The position field specifies the element's position. An element with a 0-position is displayed on the background, while an element with a greater position is displayed on top.
Type:
  • number
Since:
  • 2.0
Example
0 {number}, indicates the first-child of the parent element, or an element displayed on the background
position

(static) resizable :boolean

The resizable field specifies whether the user can resize the element, by drag and drop.
Type:
  • boolean
Since:
  • 2.2
Example
false {boolean}, the user can not resize the element (by drag and drop)
resizable

(static) selectable :boolean

The selectable field indicates whether the user can select, move or resize the element.
Type:
  • boolean
Example
false {boolean}, the user can't select, resize or move the element
 true {boolean}, the user can select, resize or move the element
selectable

(static) shape :any

The shape field defines the shape for individual element.
  • {string} a string expression that defines the shape for the element itself
  • {object} an object of {normal, hover, click, disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
.
Type:
  • any
shape

(static) visible :boolean

The visible field indicates whether the element is visible or hidden.
Type:
  • boolean
Example
false {boolean}, hides the element
 true {boolean}, shows the element
visible