Item class (RadialMenu)

Item(oParent)

new Item(oParent)

The Item object holds all information about an item within the RadialMenu object

Every option of the RadialMenu.ItemOptions type has associated a property of the Item object. For instance, the option:

caption {string}, defines the item's caption
is associated with the property:
Caption {string}, defines the item's caption
which means that the following statements are equivalent:
oItem.Options = {caption: "font"}
oItem.SetOptions({caption: "font"})
oItem.Caption = "font"
oItem.SetCaption("font")
where oItem is an object of Item type
Parameters:
Name Type Description
oParent Item Indicates an object of Item type that specifies the parent of the item
Item

Methods

Add(oOpts) → {Item}

The Add() method adds a child-item.
Parameters:
Name Type Description
oOpts RadialMenu.ItemOptions Specifies an object of RadialMenu.ItemOptions type that holds information about the item, such as caption, image and so on. If the oOpts parameter is not-of object type it indicates the item's caption instead
Returns:
Returns the child-item as an object of Item type
Type
Item
Add

Clear()

The Clear() method clears the item's descendants only.
Clear

GetCaption() → {string}

The GetCaption() method returns the item's caption (ex-HTML format, shown on "items" portion only)
Returns:
Returns the item's exHTML caption it displays
Type
string
GetCaption

GetColor() → {string}

The GetColor() method returns the item's background color to be shown within the "items" portion of the control.
Returns:
Returns the CSS color to be shown within the "items" portion of the control.
Type
string
GetColor

GetDisabled() → {boolean}

The GetDisabled() method specifies whether the item is disabled or enabled
Returns:
Returns true if the item is disabled, or false if the item is enabled.
Type
boolean
GetDisabled

GetEnabled() → {boolean}

The GetEnabled() method specifies whether the item is enabled or disabled
Returns:
Returns true if the item is enabled, or false if the item is disabled.
Type
boolean
GetEnabled

GetImage() → {string}

The GetImage() method returns the item's image. The image is applied on "items" portion only.
Returns:
Returns the name of the image the item displays.
Type
string
GetImage

GetIndex() → {number}

The GetIndex() method returns the index of the item (0-based)
Returns:
Returns the index of the item (0-based)
Type
number
GetIndex

GetKey() → {string}

The GetKey() method returns the item's key.
Returns:
Returns the item's exHTML key it displays
Type
string
GetKey

GetOptions() → {RadialMenu.ItemOptions}

The GetOptions() method returns the item's caption, image, ... all information the item displays.
Returns:
Returns an object of RadialMenu.ItemOptions type
Type
RadialMenu.ItemOptions
GetOptions

GetParent() → {Item}

The GetParent() method returns the item's parent
Since:
  • 2.4
Returns:
Returns the item's parent
Type
Item
GetParent

GetPosition() → {number}

The GetPosition() method specifies the item's position
Returns:
Returns the position of the item (0-based)
Type
number
GetPosition

GetSubCaption() → {string}

The GetSubCaption() method returns the item's caption (ex-HTML format, shown under the "sub-items" portion only)
Returns:
Returns the caption the item displays it.
Type
string
GetSubCaption

GetSubColor() → {string}

The GetSubColor() method returns the item's background color to be shown within the "sub-items" portion of the control.
Returns:
Returns the CSS color to be shown within the "sub-items" portion of the control.
Type
string
GetSubColor

GetSubImage() → {string}

The GetSubImage() method returns the item's image. The subImage is applied on "sub-items" portion only.
Returns:
Returns the item's image.
Type
string
GetSubImage

GetVisible() → {boolean}

The GetVisible() method returns whether the item is visible or hidden
Returns:
Returns true if the item is visible, or false if the item is not visible
Type
boolean
GetVisible

Item(key) → {Item}

The Item() method searches for an item giving its key or caption
Parameters:
Name Type Description
key any The key parameter can be any of the following:
  • key {object}, Indicates an object of Item that specifies the item itself
  • key {string}, Specifies the item's key or plain-caption
Returns:
Returns null or an object of Item type with specified key / caption that descends from the item.
Type
Item
Item

Load(value) → {Item}

The Load() method loads new items from a string representation. Short, the Load() method replaces the current item, which means it removes the item, and replaces with a new content. For instance, Load("") removes the element!
Parameters:
Name Type Description
value string Specifies the items to assign to the item. The string representation supports the following flags:
  • [key] {string}, specifies the item's key (Key/GetKey()/SetKey(value) methods of Item). If missing, the item's plain-caption (caption with no HTML tags) is considered as item's key. You can get an item giving its key using Root.Item(key) method. For instance, [key=color], change the item's key to "color"
  • [vis]/[hid] {number}, shows or hides the item (Visible/GetVisible()/SetVisible(value) methods of Item). For instance, [vis=0] or [hid], hides the item, while [vis=1] shows the item
  • [dis] {number}, enables or disables the item (Enabled/GetEnabled()/SetEnabled(value) methods of Item). For instance, [dis=0] or [dis], disables the item, while [dis=1] enables the item
  • [pos] {number}, changes the item's position (0-based) (Position/GetPosition()/SetPosition(value) methods of Item). For instance, [pos=0] indicates that the item should be displayed first
  • [img] {string}, assigns a image/picture to the item (Image/GetImage()/SetImage(value) methods of Item). For instance, [img=logo] assigns the "logo" picture to the item. The image can be added using the exontrol.HTMLPicture.Add() method. You can use the [simg] flag to define the item's image to be displayed on the "sub-items" portion of the control.
  • [color] {string}, specifies the item's background color (Color/GetColor()/SetColor(value) methods of Item). For instance, [color=red] or [color=rgba(255,0,0,1)] shows the item's background color in red. The [color] flag is applied for "items" portion of the control. You can use the [scolor] flag to define the item's background color for "sub-items" portion of the control.
  • [scap] {string}, specifies the item's caption to be displayed by "sub-items" portion only (SubCaption/GetSubCaption()/SetSubCaption(value) methods of Item). For instance, [scap=<b>Exit] displays Exit in bold.
  • [simg] {string}, specifies the item's image to be shown under "sub-items" section of the control (SubImage/GetSubImage()/SetSubImage(value) methods of Item). For instance, [simg=logo] assigns the "logo" picture to the item. The image can be added using the exontrol.HTMLPicture.Add() method. You can use the [img] flag to define the item's image to be displayed on the "items" portion of the control.
  • [scolor] {string}, specifies the item's background color to be displayed by "sub-items" portion only (SubColor/GetSubColor()/SetSubColor(value) methods of Item). For instance, [scolor=red] or [scolor=rgba(255,0,0,1)] shows the item's background color in red. The [scolor] flag is applied for "sub-items" portion of the control. You can use the [color] flag to define the item's background color for "items" portion of the control.
Returns:
Returns the item itself.
Type
Item
Example
Load("1,2,3"), adds three child-items.
Load

Remove()

The Remove() method removes the item (including all its descendants)
Remove

Save() → {string}

The Save() method returns the string-representation of the item, and all its descendent-items.
Returns:
Returns the string representation of the item, and all its descendent-items. The string representation supports the following flags:
  • [key] {string}, specifies the item's key (Key/GetKey()/SetKey(value) methods of Item). If missing, the item's plain-caption (caption with no HTML tags) is considered as item's key. You can get an item giving its key using Root.Item(key) method. For instance, [key=color], change the item's key to "color"
  • [vis]/[hid] {number}, shows or hides the item (Visible/GetVisible()/SetVisible(value) methods of Item). For instance, [vis=0] or [hid], hides the item, while [vis=1] shows the item
  • [dis] {number}, enables or disables the item (Enabled/GetEnabled()/SetEnabled(value) methods of Item). For instance, [dis=0] or [dis], disables the item, while [dis=1] enables the item
  • [pos] {number}, changes the item's position (0-based) (Position/GetPosition()/SetPosition(value) methods of Item). For instance, [pos=0] indicates that the item should be displayed first
  • [img] {string}, assigns a image/picture to the item (Image/GetImage()/SetImage(value) methods of Item). For instance, [img=logo] assigns the "logo" picture to the item. The image can be added using the exontrol.HTMLPicture.Add() method. You can use the [simg] flag to define the item's image to be displayed on the "sub-items" portion of the control.
  • [color] {string}, specifies the item's background color (Color/GetColor()/SetColor(value) methods of Item). For instance, [color=red] or [color=rgba(255,0,0,1)] shows the item's background color in red. The [color] flag is applied for "items" portion of the control. You can use the [scolor] flag to define the item's background color for "sub-items" portion of the control.
  • [scap] {string}, specifies the item's caption to be displayed by "sub-items" portion only (SubCaption/GetSubCaption()/SetSubCaption(value) methods of Item). For instance, [scap=<b>Exit] displays Exit in bold.
  • [simg] {string}, specifies the item's image to be shown under "sub-items" section of the control (SubImage/GetSubImage()/SetSubImage(value) methods of Item). For instance, [simg=logo] assigns the "logo" picture to the item. The image can be added using the exontrol.HTMLPicture.Add() method. You can use the [img] flag to define the item's image to be displayed on the "items" portion of the control.
  • [scolor] {string}, specifies the item's background color to be displayed by "sub-items" portion only (SubColor/GetSubColor()/SetSubColor(value) methods of Item). For instance, [scolor=red] or [scolor=rgba(255,0,0,1)] shows the item's background color in red. The [scolor] flag is applied for "sub-items" portion of the control. You can use the [color] flag to define the item's background color for "items" portion of the control.
Type
string
Save

SetCaption(value) → {Item}

The SetCaption() method changes the item's caption (ex-HTML format, shown on "items" portion only)
Parameters:
Name Type Description
value string Specifies a new ex-HTML caption to be assigned to the item
Returns:
Returns the item itself.
Type
Item
Example
null {null}, indicates no caption
 "caption" {string}, declares a plain-caption
 "&lt;b>text&lt;/b>" {string}, displays the text in bold
 "&lt;img>logo&lt;/img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method
SetCaption

SetColor(value)

The SetColor() method changes the item's background color. The color is applied on the "items" portion of the control.
Parameters:
Name Type Description
value string Specifies the CSS color to be shown within the "items" portion of the control.
Example
null {null}, indicates no color
 "red" {string}, defines a red-pie
 "rgb(255,0,0)" {string}, defines a red-pie
 "rgba(255,0,0,0.5)" {string}, defines a 50% red-pie
SetColor

SetDisabled(value)

The SetDisabled() method disables or enables the item
Parameters:
Name Type Description
value boolean Indicates a boolean expression that specifies whether the item is disabled or enabled
SetDisabled

SetEnabled(value)

The SetEnabled() method enables or disables the item
Parameters:
Name Type Description
value boolean Indicates a boolean expression that specifies whether the item is enabled or disabled
Example
false {boolean}, disables the item (including all its descendent items)
 true {boolean}, enables the item
SetEnabled

SetImage(value)

The SetImage() method changes the item's image. The image can be added using the exontrol.HTMLPicture.Add() method. The image is applied on "items" portion only.
Parameters:
Name Type Description
value string Indicates the name of the image the item displays.
Example
null {null}, indicates no image
 "logo" {string}, displays the "logo" image
SetImage

SetKey(value)

The SetKey() method assigns a new key to the item
Parameters:
Name Type Description
value string Specifies a new key to be assigned to the item
Example
"logo" {string}, defines the item with the giving key (logo). You can use the Root.Item("logo") method to request the item giving its key.
SetKey

SetOptions(oOpts)

The SetOptions() method assigns a caption, image, ... to the item.
Parameters:
Name Type Description
oOpts RadialMenu.ItemOptions Specifies an object of RadialMenu.ItemOptions type that holds information about the item, such as caption, image and so on. If the oOpts parameter is not-of object type it indicates the item's caption instead
SetOptions

SetPosition(value)

The SetPosition() method gets or sets the item's position
Parameters:
Name Type Description
value number Specifies the item's position
SetPosition

SetSubCaption(value) → {Item}

The SetSubCaption() method changes the item's caption (ex-HTML format, shown under the "sub-items" portion only)
Parameters:
Name Type Description
value string Specifies a new ex-HTML caption to be assigned to the item.
Returns:
Returns the item itself.
Type
Item
Example
null {null}, indicates no caption
 "caption" {string}, declares a plain-caption
 "&lt;b>text&lt;/b>" {string}, displays the text in bold
 "&lt;img>logo&lt;/img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method
SetSubCaption

SetSubColor(value)

The SetSubColor() method changes the item's background color. The color is applied on the "sub-items" portion of the control.
Parameters:
Name Type Description
value string Specifies the CSS color to be shown within the "sub-items" portion of the control.
Example
null {null}, indicates no color
 "red" {string}, defines a red-pie
 "rgb(255,0,0)" {string}, defines a red-pie
 "rgba(255,0,0,0.5)" {string}, defines a 50% red-pie
SetSubColor

SetSubImage(value)

The SetSubImage() method changes the item's image. The image is applied on "sub-items" portion only.
Parameters:
Name Type Description
value string Indicates the item's image. The image can be added using the exontrol.HTMLPicture.Add() method.
Example
null {null}, indicates no image
 "logo" {string}, displays the "logo" image
SetSubImage

SetVisible(value)

The SetVisible() method shows or hides the item
Parameters:
Name Type Description
value boolean Indicates a boolean expression that specifies whether the item is visible or hidden
Example
false {boolean}, hides the item (including all its descendent items)
 true {boolean}, shows the item
SetVisible

forEach(callBack, thisArg)

The forEach() method enumerates recursively the children items (not including the item itself)
Parameters:
Name Type Description
callBack callBack A callback function to be invoked on each item. The callback is invoked with one argument:
  • item {Item}, specifies the item as an object of Item type
thisArg any Indicates the value of this keyword during the callback. If not specified, this indicates the current item
forEach