new Menu(client, oOptsopt)
Every option of the Menu.Options type has associated a property of the control. For instance, the option:
debug {boolean}, indicates whether the control displays debug-informationis associated with the property:
Debug {boolean}, indicates whether the control displays debug-informationwhich means that the following statements are equivalent:
oMenu.Options = {debug: true}where oMenu is an object of Menu type
oMenu.SetOptions({debug: true})
oMenu.Debug = true
oMenu.SetDebug(true)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
client |
any | The client parameter indicates the control's client area as:
|
|
oOpts |
object |
<optional> |
An object of Menu.Options type that defines different options to display the control. |
Requires:
- module:exontrol.commmon.min.js
Requires
- module:exontrol.commmon.min.js
Classes
Members
(static, readonly) AlignContextMenuEnum :number
Each AlignContextMenuEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A combination of one or more compatible enumeration constants, separated by the | operator.
- A case-insensitive partial string containing one or more comma-separated names that match the enumeration constants.
For instance, the string "left,top" is equivalent to the numeric value 0, or to the combination of enumeration constants exLeftAlign | exTopAlign.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exLeftAlign |
0 |
number | The exLeftAlign value positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter. |
exCenterAlign |
4 |
number | The exCenterAlign value centers the shortcut menu horizontally relative to the coordinate specified by the x parameter |
exRightAlign |
8 |
number | The exRightAlign value positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter. |
exTopAlign |
0 |
number | The exTopAlign value positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter. |
exVCenterAlign |
16 |
number | The exVCenterAlign value centers the shortcut menu vertically relative to the coordinate specified by the y parameter. |
exBottomAlign |
32 |
number | The exBottomAlign value positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter. |
(static, readonly) ArrangeItemsEnum :number
Each ArrangeItemsEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A combination of one or more compatible enumeration constants, separated by the | operator.
- A case-insensitive partial string containing one or more comma-separated names that match the enumeration constants.
For instance, the string "horizontal,wrap,center" is equivalent to the numeric value 1281, or to the combination of enumeration constants exArrangeItemsHorizontal | exArrangeItemsWrap | exArrangeItemsAlignCenter.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exArrangeItemsHorizontal |
1 |
number | The exArrangeItemsHorizontal flag specifies that the items are horizontally arranged from left to right. |
exArrangeItemsVertical |
2 |
number | The exArrangeItemsVertical flag specifies that the items are vertically arranged from top to bottom. |
exArrangeItemsHideTopArrow |
16 |
number | The exArrangeItemsHideTopArrow flag indicates that the arrow for any top-item is not visible (not valid for float-menu). |
exArrangeItemsPopupAlign |
32 |
number | The exArrangeItemsPopupAlign flag specifies that the item's float/popup-menu should be displayed to prevent overlapping other items. |
exArrangeItemsWrap |
256 |
number | The exArrangeItemsWrap flag wraps items on a new row/column (not valid for float-menu). |
exArrangeItemsScroll |
512 |
number | The exArrangeItemsScroll flag specifies that the control's scroll bar is displayed if required |
exArrangeItemsAlignCenter |
1024 |
number | The exArrangeItemsAlignCenter flag centers the items on each row/column. |
exArrangeItemsAlignReverse |
2048 |
number | The exArrangeItemsAlignReverse flag reverses the alignment of the items. |
(static, readonly) CloseOnClickEnum :number
Each CloseOnClickEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A case-insensitive string containing the name that matches the enumeration constant.
For instance, the string "any" is equivalent to the numeric value -1, or to the enumeration constant exCloseOnAny.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exCloseOnDefault |
0 |
number | The exCloseOnDefault flag indicates that the float-menu is closed once the user clicks an enabled item with no check, radio or button associated. |
exCloseOnDisabled |
1 |
number | The exCloseOnDisabled flag specifies that the float-menu is closed once the user clicks a disabled item. |
exCloseOnSeparator |
2 |
number | The exCloseOnSeparator flag specifies that the float-menu is closed once the user clicks a separator item. |
exCloseOnButton |
4 |
number | The exCloseOnButton flag specifies that the float-menu is closed once the user clicks an item of button-type. |
exCloseOnCheck |
8 |
number | The exCloseOnCheck flag specifies that the float-menu is closed once the user clicks an item of check-type. |
exCloseOnRadio |
16 |
number | The exCloseOnRadio flag specifies that the float-menu is closed once the user clicks an item of radio-type. |
exCloseOnState |
24 |
number | The exCloseOnState flag specifies that the float-menu is closed once the user clicks an item of check or radio-type. |
exCloseOnAny |
-1 |
number | The exCloseOnAny flag specifies that the float-menu is closed once the user clicks any item. |
(static, readonly) DisplayTypeEnum :number
Each DisplayTypeEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A case-insensitive partial string containing a name that matches the enumeration constants.
For instance, the string "radio" is equivalent to the numeric value 2, or to the enumeration constant exRadio.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exNormal |
0 |
number | The exNormal value indicates a normal item. |
exCheck |
1 |
number | The exCheck value specifies that the item displays a check-box |
exRadio |
2 |
number | The exRadio value specifies that the item displays a radio-button |
(static, readonly) FlatEnum :number
Each FlatEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A case-insensitive partial string containing the name that matches the enumeration constant.
For instance, the string "alwaysflat" is equivalent to the numeric value 2, or to the enumeration constant exAlwaysFlat.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exNormal |
0 |
number | The exNormal flag indicates that the menu's flat bar is not shown. |
exShowFlat |
1 |
number | The exShowFlat flag indicates that the menu's flat bar is visible only if the menu contains items with check, radio or image. |
exAlwaysFlat |
2 |
number | The exAlwaysFlat flag indicates that the menu's flat bar is always visible. |
(static, readonly) GroupPopupEnum :number
Each GroupPopupEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A combination of one or more compatible enumeration constants, separated by the | operator.
- A case-insensitive partial string containing one or more comma-separated names that match the enumeration constants.
For instance, the string "group,samewidth,vertical" is equivalent to the numeric value 273, or to the combination of enumeration constants exGroup | exSameWidth | exGroupVertical.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exNone |
0 |
number | The exNone flag specifies that no grouping is performed on the popup item. |
exGroup |
1 |
number | The exGroup flag groups and displays the sub-menu items on the current item, arranged from left to right (horizontally). |
exSameWidth |
16 |
number | The exSameWidth flag displays the sub-items with the same width. |
exSameHeight |
32 |
number | The exSameHeight flag displays the sub-items with the same height. |
exGroupVertical |
256 |
number | The exGroupVertical flag groups and displays the sub-menu items on the current item, arranged from top to bottom (vertically). |
(static, readonly) ShowAsButtonEnum :number
Each ShowAsButtonEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A combination of one or more compatible enumeration constants, separated by the | operator.
- A case-insensitive partial string containing one or more comma-separated names that match the enumeration constants.
For instance, the string "button,selectlist" is equivalent to the numeric value 513, or to the combination of enumeration constants exButton | exSelectList.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exNone |
0 |
number | The exNone flag indicates that no button is associated with the item. |
exButton |
1 |
number | The exButton flag indicates that the item displays a button |
exSelectButton |
17 |
number | The exSelectButton flag indicates a select button is associated with the current item ( show the drop-down button to the right ). |
exSelectButtonDown |
273 |
number | The exSelectButtonDown flag indicates a select button is associated with the current item ( show the drop-down button to the bottom ). |
exSelectList |
512 |
number | The exSelectList flag indicates a select button is associated with the current item ( the drop down is shown when the user clicks any part of the button ). |
(static, readonly) ShowCheckedAsSelectedEnum :number
Each ShowCheckedAsSelectedEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A case-insensitive partial string containing a name that matches the enumeration constants.
For instance, the string "item" is equivalent to the numeric value 1, or to the enumeration constant exItemHighlight.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exDefault |
0 |
number | The exDefault value indicates that no highlight is applied to the item's check/radio |
exCheckHighlight |
-1 |
number | The exCheckHighlight value highlights the checked item. |
exItemHighlight |
1 |
number | The exItemHighlight value highlights the checked item, but hides the item's check/radio button. |
(static, readonly) ShowPopupAlignEnum :number
Each ShowPopupAlignEnum property can be specified in one of the following ways:
- A numeric value.
- A single enumeration constant.
- A case-insensitive partial string containing a name that matches the enumeration constants.
For instance, the string "right" is equivalent to the numeric value 2, or to the enumeration constant exRight.
Type:
- number
Properties:
| Name | value | Type | Description |
|---|---|---|---|
exNone |
0 |
number | The exNone value indicates that the sub-menu/popup is shown up-left aligned relative to the parent item. |
exDown |
1 |
number | The exDown value indicates that the sub-menu/popup is shown down-aligned relative to the parent item. |
exRight |
2 |
number | The exRight value indicates that the sub-menu/popup is shown right-aligned relative to the parent item. |
(static, readonly) type :string
Type:
- string
- Since:
- 1.8
Example
console.log(exontrol.Menu.type); // logs "Menu"
(static, readonly) version :string
Type:
- string
Example
console.log(exontrol.Menu.version); // displays the version of the control, for instance "5.2"
(static) timeoutOC :number
Type:
- number
Align :number
The Align property can be any of the following values:
- -1 {number}, specifies that the item's caption full-fits the item's background. You can use the <c> or <r> ex-HTML tags to align portions of caption inside the item
- 0 {number}, indicates that the caption is left-aligned
- +1 {number}, specifies that the caption is centered
- +2 {number}, specifies that the caption is right-aligned
Type:
- number
Example
2 {number}, right aligns the item's caption
Align
AlignClient :boolean
Type:
- boolean
Example
false {boolean}, specifies that the item and its sub-items are not vertically aligned (when a popup is opened)
true {boolean}, specifies that the item and its sub-items are vertically aligned (when a popup is opened)
AlignClient
AlignContextMenu :Menu.AlignContextMenuEnum
The Menu.AlignContextMenuEnum type defines the following flags:
- exLeftAlign (0x00), positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter
- exCenterAlign (0x04), centers the shortcut menu horizontally relative to the coordinate specified by the x parameter
- exRightAlign (0x08), positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter
- exTopAlign (0x00), positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter
- exVCenterAlign (0x10), centers the shortcut menu vertically relative to the coordinate specified by the y parameter
- exBottomAlign (0x20), positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter
The AlignContextMenu property has effect only, if the control is opened as a context-menu, using the Open() method.
Type:
Example
0 or Menu.AlignContextMenuEnum.exLeftAlign | Menu.AlignContextMenuEnum.exTopAlign {number}, the context-menu is shown aligned to x and y properties
20 or Menu.AlignContextMenuEnum.exCenterAlign | Menu.AlignContextMenuEnum.exVCenterAlign {number}, centers the context-menu relative to x and y properties
32 or Menu.AlignContextMenuEnum.exLeftAlign | Menu.AlignContextMenuEnum.exBottomAlign {number}, opens the context-menu right to the x and y properties
AlignContextMenu
AllowToggleRadio :boolean
Type:
- boolean
Example
false {boolean}, no radio-item toggles its state (once the user clicks a checked radio-item, it stays checked (state on 1))
true {number}, any radio-item toggles its state (once the user clicks a checked radio-item, it gets unchecked (state on 0))
AllowToggleRadio
ArrSize :number
Type:
- number
Example
0 {number}, indicates that no arrow is shown
6 {number}, indicates that the arrow is displayed into a square of 6x6 pixels
ArrSize
ArrangeItemsAs :Menu.ArrangeItemsEnum
The Menu.ArrangeItemsEnum type supports the following flags:
- exArrangeItemsHorizontal (1), specifies that the items are horizontally arranged from left to right
- exArrangeItemsVertical (2), specifies that the items are vertically arranged from top to bottom
- exArrangeItemsHideTopArrow (0x10), indicates that the arrow for any top-item is not visible (not valid for float-menu)
- exArrangeItemsPopupAlign (0x20), specifies that the item's float/popup-menu should be displayed to prevent overlapping other items
- exArrangeItemsWrap (0x100), wraps items on a new row/column (not valid for float-menu)
- exArrangeItemsScroll (0x200), specifies that the control's scroll bar is displayed if required
- exArrangeItemsAlignCenter (0x400), centers the items on each row/column
- exArrangeItemsAlignReverse (0x800), reverses the alignment of the items
Type:
Example
561 or Menu.ArrangeItemsEnum.exArrangeItemsHideTopArrow | Menu.ArrangeItemsEnum.exArrangeItemsHorizontal | Menu.ArrangeItemsEnum.exArrangeItemsScroll | Menu.ArrangeItemsEnum.exArrangeItemsPopupAlign {number}, arranges horizontally all items of top-level menu
ArrangeItemsAs
BtnArrSize :number
Type:
- number
Example
0 {number}, indicates that no arrow is shown for an item of button type ([button])
6 {number}, indicates that the arrow is displayed into a square of 6x6 pixels
BtnArrSize
BtnPad :number|Array.<number>|string
Type:
- number | Array.<number> | string
Example
4 {number}, increases the object's client with 2 * 4-pixels, which includes width and height
"8,4" {string}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
[8,4] {array}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
BtnPad
CloseOnClick :Menu.CloseOnClickEnum
The Menu.CloseOnClickEnum type defines the following flags:
- exCloseOnDefault (0), indicates that the float-menu is closed once the user clicks an enabled item with no check, radio or button associated
- exCloseOnDisabled (1), specifies that the float-menu is closed once the user clicks a disabled item
- exCloseOnSeparator (2), specifies that the float-menu is closed once the user clicks a separator item
- exCloseOnButton (4), specifies that the float-menu is closed once the user clicks an item of button-type
- exCloseOnCheck (8), specifies that the float-menu is closed once the user clicks an item of check-type
- exCloseOnRadio (16), specifies that the float-menu is closed once the user clicks an item of radio-type
- exCloseOnState (24), specifies that the float-menu is closed once the user clicks an item of check or radio-type
- exCloseOnAny (-1), specifies that the float-menu is closed once the user clicks any type of item anywhere
Type:
Example
0 or Menu.CloseOnClickEnum.exCloseOnDefault {number}, specifies that the float-menu is closed once the user clicks an enabled item with no check, radio or button associated
-1 or Menu.CloseOnClickEnum.exCloseOnAny {number}, specifies that the float-menu is closed once the user clicks any type of item anywhere
CloseOnClick
CriAlign :boolean
Type:
- boolean
Example
false {boolean}, check-box/radio-button or the item's image is not vertically aligned
true {boolean}, check-box/radio-button or the item's image is vertically aligned
CriAlign
CriFlat :Menu.FlatEnum
- exNormal (0), indicates that the menu's flat bar is not shown
- exShowFlat (1), indicates that the menu's flat bar is visible only if the menu contains items with check, radio or image
- exAlwaysFlat (2), indicates that the menu's flat bar is always visible
Type:
Example
2 or Menu.FlatEnum.exAlwaysFlat {number}, defines a flat-menu
CriFlat
CriPad :number|Array.<number>|string
Type:
- number | Array.<number> | string
Example
4 {number}, increases the object's client with 2 * 4-pixels, which includes width and height
"8,4" {string}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
[8,4] {array}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
CriPad
CriSize :number
Type:
- number
Example
16 {number}, indicates that any check-box, radio or image uses a 16x16 rectangle to display it within the item
CriSize
Cursors :string
The format of the property is:
"cursor(part),cursor(part),..."where:
- "cursor", defines the CSS mouse cursor to display while cursor hovers the part
- "part", defines the name of the part the cursor is applied on (as defined below)
The "part" can be any of the following:
Cursor Description "alias" indicates a shortcut or alias will be created "all-scroll" indicates scrolling in any direction "auto" lets the browser decide the cursor based on context "cell" indicates a table cell "col-resize" indicates a column can be resized horizontally "context-menu" indicates a context menu is available "copy" indicates something will be copied "crosshair" a precise crosshair cursor "default" the default arrow cursor "e-resize" resize east (right edge) "ew-resize" resize horizontally "grab" indicates an item can be grabbed "grabbing" indicates an item is being grabbed "help" indicates help information is available "move" indicates something can be moved "n-resize" resize north (top edge) "ne-resize" resize northeast (top-right corner) "nesw-resize" resize along the northeast–southwest axis "no-drop" indicates dropping is not permitted "not-allowed" indicates the action is not allowed "ns-resize" resize vertically "nw-resize" resize northwest (top-left corner) "nwse-resize" resize along the northwest–southeast axis "pointer" the pointer cursor (a hand with a pointing finger) "progress" indicates background processing "row-resize" indicates a row can be resized vertically "s-resize" resize south (bottom edge) "se-resize" resize southeast (bottom-right corner) "sw-resize" resize southwest (bottom-left corner) "text" the text selection cursor (I-beam) "url(...)" uses a custom cursor image (with optional fallback) "vertical-text" the vertical text selection cursor "w-resize" resize west (left edge) "wait" indicates the program is busy "zoom-in" indicates zooming in "zoom-out" indicates zooming out
Part Description "anchor" (hyperlink) defines the mouse-cursor when the mouse pointer hovers the anchor (the <a> ex-HTML part marks an anchor or hyperlink element) (@since 2.2) "arr" (arrow) defines the mouse-cursor to show when the mouse pointer hovers the item's arrow (while the item contains un-grouped sub-items) "barr" (bottom-arrow) defines the mouse-cursor to show when the mouse pointer hovers the button's arrow (to bottom) "btn" (button) defines the mouse-cursor to show when the mouse pointer hovers the buttons "cap" (caption) defines the mouse-cursor to show when the mouse pointer hovers the item's caption "chk" (check) defines the mouse-cursor to show when the mouse pointer hovers the item's check-box "flat" (flat) defines the mouse-cursor to show when the mouse pointer hovers menu's flat bar (usually shown in the left side of the menu) "img" (image) defines the mouse-cursor to show when the mouse pointer hovers the item's image "item" (item) defines the mouse-cursor to show when the mouse pointer hovers the item's background. It covers all parts of the item as check, image, caption/button, popup arrow and sub-items "menu" (menu) defines the mouse-cursor to show when the mouse pointer hovers the entire menu "rad" (radio) defines the mouse-cursor to show when the mouse pointer hovers the item's radio-button "rarr" (right-arrow) defines the mouse-cursor to show when the mouse pointer hovers the button's arrow (to right) "sep" (separator) defines the mouse-cursor to show when the mouse pointer hovers the separator-items "sub" (sub-items) defines the mouse-cursor to show when the mouse pointer hovers the sub-items of the item (while the item is grouped)
Type:
- string
Example
"" {string}, no mouse cursor support
"pointer(chk,rad,btn)" {string}, indicates that the "pointer" mouse cursor is shown once the cursor hovers the "chk", "rad" or "btn" parts of the control
Cursors
Debug :boolean
Type:
- boolean
Example
false {boolean}, no debug-information is displayed
true {boolean}, debug-information is displayed for each item (usually the item's identifier)
Debug
Items :string
The format of the items'string representation is (everything between () refers to children, and everything between [] refers to flags):
"item1[flag=value]...[flag=value](sub-item1[flag=value]...[flag=value],...,sub-itemn[flag=value]...[flag=value]),...,itemn[flag=value]...[flag=value](sub-item1[flag=value]...[flag=value],...,sub-itemn[flag=value]...[flag=value])"or shortly:
item[flag=value][...](sub-item[flag=value][...], ...), ...
The string-representation supports the following flags:
Flag Description Sample [align] Horizontally aligns the caption. Align could be -1 (full-fits the item), 0 (left), 1 (center), or 2 (right). "[align=2]" [arrow] Indicates whether the item's popup-arrow is shown(1) or hidden(0). "[arrow=0]", "[arrow=1]" [button] Associates a button with the item. The option may be a combination of Menu.ShowAsButtonEnum flags. The btnPad field defines the button's padding (space between the button border and the item content) The btnArrSize field specifies the size (width and height) to show the button's arrow. "[button]" or "[button=down]" [captionHeight] / [ch] Specifies the height of the item's caption. A negative value removes the limitation. "[ch=128]" [captionWidth] / [cw] Specifies the width of the item's caption. A negative value removes the limitation. "[cw=128]" [close] Specifies whether the float-menu is closed once the user clicks the item. The option could be a value of Menu.CloseOnClickEnum type. "[close=any]" or "[close=-1]" [chk] Indicates that the item has a check-box associated. If [typ] is present, [chk] indicates the state of the item, and [rad] is ignored. "[chk]", "[chk=0]", "[chk=1]" [cursors] Defines the mouse cursor for the item only. "[cursors=pointer(item)]" [dis] Disables the item and all its descendents. "[dis]" [grp] Defines the radio group. Use when defining multiple groups of radio buttons. "[grp=sample]" [height] Specifies the height of the item. "[height=64]" [hid] Hides or shows the item. "[hid]" [id] Specifies the item's identifier. "[id=10]" [img] Indicates the item's image. The image must be previously added using exontrol.HTMLPicture.Add. "[img=logo]" [itemsPad] Specifies the items' padding (space between the menu border and the item content). "[itemsPad=2]", "[itemsPad=2,2]" [pad] Specifies the item's padding (space between the menu border and the item content). "[pad=2]", "[pad=2,2]" [popupalign] / [pa] Aligns the sub-menu/popup/float relative to the parent item. The option may be a combination of Menu.ShowPopupAlignEnum flags. "[pa=down]" or "[pa=1]" [sep] Specifies a separator item. The sepSize field specifies the size of a separator item. "[sep]" [show] Specifies how an item with check-box/radio-button is displayed. The option may be any value of Menu.ShowCheckedAsSelectedEnum type. "[show=check]" or "[show=-1]" [showdis] Displays the item as disabled while still enabled. "[showdis]" [spchk] Indicates whether sub-items are shown when the item is checked. "[spchk]" [tab] Indicates the identifier of the sub-items of the current item. "[tab=page]", "[tab=1]" [typ] Specifies the type of the item: 0 (normal), 1 (check-box), or 2 (radio button). If [typ] is present, [chk] indicates the state and [rad] is ignored. This option may be any value of Menu.DisplayTypeEnum type. "[typ=check]" or "[typ=1]" [width] Specifies the width of the item. "[width=64]" [group] Specifies how the sub-items are grouped. The option may be a combination of Menu.GroupPopupEnum flags. "[group=vertical]" or "[group=0x100]" [rad] Indicates that the item has a radio-button associated. If [typ] is present, [chk] indicates the state and [rad] is ignored. "[rad]", "[rad=0]", "[rad=1]" [shapes] Specifies shapes to apply on the item only. "[shapes=dfitem(item),dfcap(cap)]"
Type:
- string
Example
"" {string}, clears the items collection
"Popup(A,B,C)" {string}, adds a popup-item with three sub-items A, B and C
"Popup[group](A,B,C)" {string}, adds an item with three sub-items A, B and C, and all items are visible and displayed as an horizontally group
"Popup[group][chk][spchk](A,B,C)" {string}, adds an item with three sub-items A, B and C, but A, B and C sub-items are visible and displayed only if the popup is checked
Items
ItemsPad :number|Array.<number>|string
Type:
- number | Array.<number> | string
Example
4 {number}, increases the object's client with 2 * 4-pixels, which includes width and height
"8,4" {string}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
[8,4] {array}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
ItemsPad
Listeners :exontrol.Lts
Type:
- exontrol.Lts
Example
The following sample shows how you can get all events the component currently supports:
oMenu.Listeners.forEach(function(name)
{
console.log(name);
});
The following sample displays the item being selected:
oMenu.Listeners.Add("onselect", function (oEvent)
{
console.log(oEvent);
});
or
oMenu.on("select", function (oEvent)
{
console.log(oEvent);
});
where oMenu is an object of Menu type
Listeners
Locked :boolean
Type:
- boolean
Example
false {boolean}, unlocks the control (can select any item)
true {boolean}, locks the control (can't select any item)
Locked
Options :Menu.Options
Type:
Example
Options = {debug: true}, sets that the control runs in debug mode (dispays identifiers of items during drawing)
console.log( oMenu.Options.open ) {number}, gets the time in ms the top-level item opens its sub-menu once the cursor hovers it
The following statements are equivalent:
oMenu.SetOptions({debug: true}), sets that the control runs in debug mode (dispays identifiers of items during drawing)
oMenu.Options = {debug: true}, sets that the control runs in debug
oMenu.Debug = true, sets that the control runs in debug mode (dispays identifiers of items during drawing)
oMenu.SetDebug(true), sets that the control runs in debug mode (dispays identifiers of items during drawing)
where oMenu is an instance of Menu control.
Options
OutClose :number
The value of OutClose property can be any of the following:
- if positive, specifies the time in ms the control closes all its float-menu as soon as the cursor hovers outside portion of the menu
- if 0, indicates that the menu's floats are closed as soon as the cursor hovers outside portion of it
- if negative, it has no effect
Type:
- number
Example
0 {number}, indicates that the menu's floats are closed as soon as the cursor hovers outside portion of it
350 {number}, the control's float-menus are closed once 350 ms ellapsed after the cursor hovers outside portion of the menu
OutClose
Pad :number|Array.<number>|string
Type:
- number | Array.<number> | string
Example
4 {number}, increases the object's client with 2 * 4-pixels, which includes width and height
"8,4" {string}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
[8,4] {array}, increases the object's width with 2 * 8-pixels and object's height with 2 * 4-pixels
Pad
PopupRatio :number
Type:
- number
Example
0 {number}, indicates that the size of the float-menu is not influenced by the document's view size, so it will be displayed entirely as it is
0.5 {number}, indicates that the width / height of the float-menu can not exceed half of the width / height of the document's view page (control's scroll is automatically added if exArrangeItemsScroll flag is specified)
PopupRatio
ReadOnly :boolean
Type:
- boolean
Example
false {boolean}, the user can select or check any item
true {boolean}, the user can not select or check the items
ReadOnly
ScrollClip :boolean
Type:
- boolean
Example
false {boolean}, the scroll is not clipped, so it is shown over the menu
true {boolean}, the scroll and items portions of the menu are separatly
ScrollClip
ScrollOpt :exontrol.ScrollBar.Options
Type:
- exontrol.ScrollBar.Options
Example
The following example shows how to set the scrollOpt field to customize the scroll bar's appearance and behavior:
{
cursors: "pointer(t,b)",
visibleParts: "t,b",
horizontalShapes: "button(t)",
verticalShapes: "button(t)"
}
ScrollOpt
ScrollSize :number
Type:
- number
Example
0 {number}, hides the menu's scroll-bar but scrolling it is still posible by drag. Click an item and drag outside the margins so the menu gets scrolled
4 {number}, defines a 4-pixels wide scroll bar
ScrollSize
SepSize :number
Type:
- number
Example
0 {number}, hides all separator items ([sep])
4 {number}, specifies the separator items of 4-pixels size
SepSize
Shapes :string
The format of the property is:
"shape(part),shape(part),..."where:
- "shape", defines the shape to apply on the UI part as one of the following:
◦ any of 140 color names any browser supports (such as red, blue, green, ...)
◦ hexadecimal colors, is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. All values must be between 00 and FF (such as #0000ff which defines a blue background)
◦ hexadecimal colors with transparency, is specified with: #RRGGBBAA, where AA (alpha) value must be between 00 and FF (such as #0000ff80 which defines a semi-transparent blue background)
◦ RGB colors, is specified with the RGB(red, green, blue) function. Each parameter (red, green, and blue) defines the intensity of the color and can be an integer between 0 and 255( such as rgb(0,0,255) that defines a blue background)
◦ RGBA colors, are an extension of RGB color values with an alpha channel as RGBA(red, green, blue, alpha) function, where the alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque) ( such as rgba(0,0,255,0.5) which defines a semi-transparent blue background)
◦ HSL colors, is specified with the HSL(hue, saturation, lightness) function, where hue is a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue. saturation is a percentage value; 0% means a shade of gray and 100% is the full color. lightness is also a percentage; 0% is black, 100% is white. HSL stands for hue, saturation, and lightness - and represents a cylindrical-coordinate representation of colors (such as hsl(240, 100%, 50%) that defines a blue background)
◦ HSLA colors, are an extension of HSL color values with an alpha channel - which specifies the opacity of the object as HSLA(hue, saturation, lightness, alpha) function, where alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque) (such as hsla(240, 100%, 50%,0.5) that defines a semi-transparent blue background)
◦ a JSON representation of the shape object to apply (while it starts with { character, such as '{"normal": {"primitive": "RoundRect","fillColor":"black","tfi": {"fgColor": "white"}}}')
◦ specifies the name of the field within the exontrol.Shapes.Menu object (while it starts with a lowercase letter, such as dfitem which refers to exontrol.Shapes.Menu.dfitem shape)
◦ specifies the name of the field within the exontrol.Shapes object (while it starts with an uppercase letter, such as Button which refers to exontrol.Shapes.Button shape)
- "part", defines the name of the part the shape is applied on (as defined bellow)
Part Description "arr" (arrow) defines the visual appearance to display item's arrow (while the item contains un-grouped sub-items) "barr" (bottom-arrow) defines the visual appearance to display button's arrow (to bottom) "btn" (button) defines the visual appearance to display the buttons "cap" (caption) defines the visual appearance for the item's caption "chk" (check) defines the visual appearance to display the item's check-box "flat" (flat) defines the visual appearance for menu's flat bar (usually shown in the left side of the menu) "img" (image) defines the visual appearance to display the item's image "item" (item) defines the visual appearance for the item's background. It covers all parts of the item as check, image, caption/button, popup arrow and sub-items "menu" (menu) defines the visual appearance for the entire menu "rad" (radio) defines the visual appearance to display the item's radio-button "rarr" (right-arrow) defines the visual appearance to display button's arrow (to right) "sep" (separator) defines the visual appearance to display separator-items "sub" (sub-items) defines the visual appearance to display sub-items of the item (while the item is grouped)
Type:
- string
Example
null {null}, specifies the default visual appearance
"" {string}, no shape (no visual appearance is applied to any part of the control)
"red(item)", "#FF0000(item)", "rgb(255,0,0)(item)", "rgba(255,0,0,1)(item)" {string}, shows all-items in red
'{"hover":{"frameColor":"black","pad":-0.5}}(item)' {string}, draws a black-frame arround the item being hovered
"xxx(d),yyy(d,m),zzz(y)" {string}, specifies that the exontrol.Shapes.Menu.xxx combined with exontrol.Shapes.Menu.yyy object defines the visual appearance of "d" part of the control, exontrol.Shapes.Menu.yyy object defines the visual appearance of "m" part of the control and exontrol.Shapes.Menu.zzz object defines the visual appearance of "y" part of the control
Shapes
Shortcuts :exontrol.Sts
Type:
- exontrol.Sts
Example
The following sample activates the File popup-menu as soon as user presses F key:
oMenu.Shortcuts.Add( "F", function(oShortcut)
{
oMenu.Open("File");
});
where oMenu is an object of Menu type
Shortcuts
Show :Menu.ShowCheckedAsSelectedEnum
The Menu.ShowCheckedAsSelectedEnum type defines the following values:
- exDefault (0), indicates that no highlight is applied to the item's check/radio
- exCheckHighlight (-1), highlights the checked item
- exItemHighlight (1), highlights the checked item, but hides the item's check/radio button
Type:
Example
1 (Menu.ShowCheckedAsSelectedEnum.exItemHighlight) {number}, specifies that any checked-item gets highlighted, by not showing the item's check/radio button
Show
SmoothSel :number
Type:
- number
Example
0 {number}, no smooth changes once the user selects a new item
125 {number}, specifies that a smooth-transition is performed from a layout to another for 125 ms.
SmoothSel
SubArrangeItemsAs :Menu.ArrangeItemsEnum
The Menu.ArrangeItemsEnum type supports the following flags:
- exArrangeItemsHorizontal (1), specifies that the items are horizontally arranged from left to right
- exArrangeItemsVertical (2), specifies that the items are vertically arranged from top to bottom
- exArrangeItemsHideTopArrow (0x10), indicates that the arrow for any top-item is not visible (not valid for float-menu)
- exArrangeItemsPopupAlign (0x20), specifies that the item's float/popup-menu should be displayed to prevent overlapping other items
- exArrangeItemsWrap (0x100), wraps items on a new row/column (not valid for float-menu)
- exArrangeItemsScroll (0x200), specifies that the control's scroll bar is displayed if required
- exArrangeItemsAlignCenter (0x400), centers the items on each row/column
- exArrangeItemsAlignReverse (0x800), reverses the alignment of the items
Type:
Example
257 or Menu.ArrangeItemsEnum.exArrangeItemsHorizontal | Menu.ArrangeItemsEnum.exArrangeItemsWrap {number}, wraps items within the float-menu
546 or Menu.ArrangeItemsEnum.exArrangeItemsVertical | Menu.ArrangeItemsEnum.exArrangeItemsScroll | Menu.ArrangeItemsEnum.exArrangeItemsPopupAlign {number}, arranges vertically the items within the float-menu
SubArrangeItemsAs
SubClose :number
The value of SubClose property can be any of the following:
- if positive, indicates the time in ms the sub-menu is closed once the cursor hovers the second-level item
- if 0, indicates that the sub-menu is closed as soon as the cursor hovers a second-level item
- if negative, it has no effect
Type:
- number
Example
0 {number}, indicates that the sub-menu is closed as soon as the cursor hovers a second-level item
350 {number}, the sub-menu is closed once 350 ms ellapsed after the cursor hovers the second-level item
SubClose
SubOpen :number
The value of SubOpen property can be any of the following:
- if positive, indicates the time in ms the item opens its sub-menu once the cursor hovers it.
- if 0, indicates that the item opens its sub-menu as soon as the cursor hovers it
- if negative, it has no effect so the item requires click in order to open its sub-menu
Type:
- number
Example
0 {number}, indicates that the item opens its sub-menu as soon as the cursor hovers it
-1 {number}, indicates that the item's sub-menu is opened once the user clicks it
SubOpen
Tfi :string|object
The Tfi property as string supports any of the following keywords (each keyword can be specified using first letters only such as "b" for "bold) separated by space characters:
- bold, displays the text in bold (equivalent of <b> tag)
- italic, displays the text in italics (equivalent of <i> tag)
- underline, underlines the text (equivalent of <u> tag)
- strikeout, specifies whether the text is strike-through (equivalent of <s> tag)
- <fontName name>, specifies the font's family (equivalent of <font name> tag)
- <fontSize size>, specifies the size of the font (equivalent of <font ;size> tag)
- <fgColor CSSColor>, specifies the text's foreground color (equivalent of <fgcolor> tag)
- <bgColor CSSColor>, specifies the text's background color (equivalent of <bgcolor> tag)
- <shaColor CSSColor;width;offset>, defines the text's shadow (equivalent of <sha color;width;offset> tag)
- <outColor CSSColor>, shows the text with outlined characters (CSScolor) (equivalent of <out color> tag)
- <graColor CSSColor;mode;blend>, defines a gradient text (equivalent of <gra color;mode;blend> tag)
Any other word within the Tfi property that's not recognized as a keyword is interpreted as:
- name of the font (not a number), specifies the font's family (equivalent of <font name> tag)
- size of the font (number), specifies the size of the font (equivalent of <font ;size> tag)
The Tfi property as object supports any of the following fields:
- bold {boolean}, displays the text in bold (equivalent of <b> tag)
- italic {boolean}, displays the text in italics (equivalent of <i> tag)
- underline {boolean}, underlines the text (equivalent of <u> tag)
- strikeout {boolean}, specifies whether the text is strike-through (equivalent of <s> tag)
- fontName {string}, specifies the font's family (equivalent of <font name> tag)
- fontSize {number}, specifies the size of the font (equivalent of <font ;size> tag)
- fgColor {string}, specifies the text's foreground color (CSScolor) (equivalent of <fgcolor> tag)
- bgColor {string}, specifies the text's background color (CSScolor) (equivalent of <bgcolor> tag)
- shaColor {object}, specifies an object of {color, width, offset} type that defines the text's shadow (equivalent of <sha color;width;offset> tag), where:
- color {string}, defines the color of the text's shadow (CSScolor)
- width {number}, defines the size of the text's shadow
- offset {number}, defines the offset to show the text's shadow relative to the text
- outColor {string}, shows the text with outlined characters (CSScolor) (equivalent of <out color> tag)
- graColor {object}, specifies an object of {color, mode, blend} type that defines a gradient text (equivalent of <gra color;mode;blend> tag), where:
- color {string}, defines the gradient-color (CSScolor)
- mode {number}, defines the gradient direction as 0 (left-right), 1 (default, top-bottom), 2 (left-center-right), and 3 (top-center-bottom)
- blend {number}, defines the gradient blend as a value between 0 and 1
CSSColor or CSS legal color values can be specified by the following methods:
- Hexadecimal colors, is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. All values must be between 00 and FF. For example, #0000ff value is rendered as blue, because the blue component is set to its highest value (ff) and the others are set to 00.
- Hexadecimal colors with transparency, is specified with: #RRGGBBAA, where AA (alpha) value must be between 00 and FF. For example, #0000ff80 defines a semi-transparent blue.
- RGB colors, is specified with the RGB(red, green, blue) function. Each parameter (red, green, and blue) defines the intensity of the color and can be an integer between 0 and 255. For example, rgb(0,0,255) defines the blue color.
- RGBA colors, are an extension of RGB color values with an alpha channel as RGBA(red, green, blue, alpha) function, where the alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque). For example, rgba(0,0,255,0.5) defines a semi-transparent blue.
- HSL colors, is specified with the HSL(hue, saturation, lightness) function, where hue is a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue. saturation is a percentage value; 0% means a shade of gray and 100% is the full color. lightness is also a percentage; 0% is black, 100% is white. HSL stands for hue, saturation, and lightness - and represents a cylindrical-coordinate representation of colors. For example, hsl(240, 100%, 50%) defines the blue color.
- HSLA colors, are an extension of HSL color values with an alpha channel - which specifies the opacity of the object as HSLA(hue, saturation, lightness, alpha) function, where alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque). For example, hsla(240, 100%, 50%,0.5) defines a semi-transparent blue.
- Predefined/Cross-browser color names, 140 color names are predefined in the HTML and CSS color specification. For example, blue defines the blue color.
Type:
- string | object
Example
null {null}, the Tfi property is ignored
"bold monospace 16 <fg blue>" {string}, defines Monospace font of 16px height, bold and blue
{bold: true, fontName: "monospace", fontSize: 16, fgColor: "blue"} {object}, defines Monospace font of 16px height, bold and blue
Tfi
WheelChange :number
- Setting WheelChange to 0 disables mouse wheel actions, preventing the control from changing when the wheel is rotated.
- Setting WheelChange to 1 applies the default scroll behavior, where the control scrolls by a standard amount with each wheel rotation.
By modifying the WheelChange value, you can fine-tune the control's responsiveness, making it easier for users to perform precise changes or larger adjustments as needed.
Type:
- number
Example
0 {number}, locks any action the mouse's wheel performs
1 {number}, indicates that the wheelChange property is applied for 1-time when user rotates the mouse wheel. Changes the wheelChange property to provide a different step to scroll once the user rotates the mouse wheel
WheelChange
X :number
Type:
- number
Example
event.pageX {number}, The pageX read-only property of the MouseEvent(event) interface returns the X (horizontal) coordinate (in pixels) at which the mouse was clicked, relative to the left edge of the entire document.
X
Y :number
Type:
- number
Example
event.pageY {number}, The pageY read-only property of the MouseEvent(event) interface returns the Y (vertical) coordinate in pixels of the event relative to the whole document.
Y
Methods
BeginUpdate()
Example
oMenu.BeginUpdate();
// performs multiple changes to the control
oMenu.EndUpdate();
BeginUpdate
Close()
Example
oMenu.Close(), closes the menu and all its float-menus
Close
EndUpdate()
Example
oMenu.BeginUpdate();
// performs multiple changes to the control
oMenu.EndUpdate();
EndUpdate
EnsureVisibleItem(oItem) → {Item}
Parameters:
| Name | Type | Description |
|---|---|---|
oItem |
Item | Indicates an object of Item type. |
Returns:
- Type
- Item
Example
oMenu.EnsureVisibleItem(oItem), scrolls the control to ensure that the oItem fits the control's visible area, where oMenu is an object of Menu type, and oItem is an object of Item type
EnsureVisibleItem
GetCanvas() → {HTMLCanvasElement}
Returns:
- Type
- HTMLCanvasElement
GetClose() → {number}
Returns:
- if positive, indicates the time in ms the sub-menu is closed once the cursor hovers the top-level item.
- if 0, indicates that the sub-menu is closed as soon as the cursor hovers a top-level item
- if negative, it has no effect
- Type
- number
Example
The following statements are equivalent:
oMenu.GetClose() {number}, returns the time in ms the sub-menu is closed once the cursor hovers the top-level item
oMenu.Close {number}, defines the time in ms the sub-menu is closed once the cursor hovers the top-level item
where oMenu is an instance of the Menu control.
GetClose
GetOpen() → {number}
Returns:
- if positive, indicates the time in ms the top-level item opens its sub-menu once the cursor hovers it.
- if 0, indicates that the top-level item opens its sub-menu as soon as cursor hovers it
- if negative, indicates that the item requires click to to open its sub-menu
- Type
- number
Example
The following statements are equivalent:
oMenu.GetOpen() {number}, returns the time in ms the top-level item opens its sub-menu once the cursor hovers it
oMenu.Open {number}, defines the time in ms the top-level item opens its sub-menu once the cursor hovers it
where oMenu is an instance of the Menu control.
GetOpen
Item(id) → {Item}
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | Indicates the item's identifier or caption to look for. The id can include \ to locate exactly an item by parent\child relation. |
Returns:
- Type
- Item
Example
oMenu.Item("File") {Item}, returns the item with the "File" caption, where oMenu is an object of Menu type
oMenu.Item("File\\New") {Item}, returns the item with the "new" identifier, which is a child of the "file" item, where oMenu is an object of Menu type
Item
Open(id) → {Menu}
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | Indicates the item's identifier or caption to open. The id can include \ to locate exactly an item by parent\child relation. (if the id is missing/undefined/null the current menu is shown as a shortcut/context-menu). |
Returns:
- Type
- Menu
Example
oMenu.Open(), opens the current menu as a shortcut/context-menu
Open
Refresh() → {Menu}
For example, call Refresh() when:
- The control's container has been resized and the layout must be recalculated.
- External CSS or styling changes affect the control's appearance.
- The control becomes visible after being hidden.
- You need to ensure the UI is visually synchronized with its current internal state.
The method does not alter the control's data, options, or configuration - it only updates the rendered output.
Returns:
- Type
- Menu
Example
oMenu.Refresh(), refreshes the control
Refresh
SetClose(value)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Indicates a numeric value that specifies the time in ms the sub-menu is closed once the cursor hovers the top-level item. No effect if negative, 0 indicates that the sub-menu is closed as soon as the cursor hovers a top-level item, else a positive value that indicates the time in ms the sub-menu is closed once the cursor hovers the top-level item.
|
Example
0 {number}, indicates that the sub-menu is closed as soon as the cursor hovers a top-level item.
350 {number}, the sub-menu is closed once 350 ms ellapsed after the cursor hovers a top-level item.
SetClose
SetOpen(value)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | A numberic value that specifies the time in ms the top-level item opens its sub-menu once the cursor hovers it, as explained:
|
Example
0 {number}, indicates that the top-level item opens its sub-menu as soon as cursor hovers it.
-1 {number}, indicates that the top-level item opens its sub-menu as soon as user clicks it.
SetOpen
SetXY(x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | A number value that specifies the horizontal position to display the context/shortcut-menu relative to document. |
y |
number | A number value that specifies the vertical position to display the context/shortcut-menu relative to document. |
Example
The following statements are equivalent:
oMenu.SetXY(event.pageX, event.pageY), sets the horizontal and vertical position to display the context/shortcut-menu relative to document
oMenu.X = event.pageX; oMenu.Y = event.pageY, sets the horizontal and vertical position to display the context/shortcut-menu relative to document
oMenu.SetX(event.pageX); oMenu.SetY(event.pageY), sets the horizontal and vertical position to display the context/shortcut-menu relative to document
where oMenu is an object of Menu type
SetXY
Shuffle(ratio)
Parameters:
| Name | Type | Description |
|---|---|---|
ratio |
number | specifies how far each element is randomized relative to the current size of the layout. For instance, 0 indicates that the element is not moved/shuffled, while 1, indicates that the element can randomize its position up to one width/height. |
Example
oMenu.Shuffle(0.5), arranges randomly all items within the control, allowing each item to randomize its position up to half of the layout width/height
oMenu.Shuffle(1), arranges randomly all items within the control, allowing each item to randomize its position up to the layout width/height
Shuffle
Unshuffle()
Example
oMenu.Unshuffle(), restores the items of the control in case they were shuffled
Unshuffle
Update(callback, thisArgopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
callback | Indicates a callback to perform changes within the control. | |
thisArg |
any |
<optional> |
Specifies the value of "this" keyword during the callback. If missing/empty/undefined the thisArg points to the control itself, as an object of Menu type. |
Example
oMenu.Update(function()
{
// performs multiple changes to the control
});
Update
forEachU(callback, thisArgopt, oItemopt) → {any}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
callback | Specifies a function of callback(oItem) {any} type that's invoked for each item. The arguments of the callback are:
oItem {Item}, specifies the item of Item type |
|
thisArg |
any |
<optional> |
Indicates the value of "this" keyword during the callback (if not specified it refers the current object as an Menu type). |
oItem |
Item |
<optional> |
Indicates the item whose child-items are recursivelly enumerated. |
Returns:
- Type
- any
Example
The following sample code enumerates all items within the control, including child items, and logs them in the console:
oMenu.forEachU(function(oItem)
{
console.log(oItem);
})
The following sample code searches for the item with caption "File" and logs it in the console:
console.log(oMenu.forEachU(function(oItem)
{
return oItem.caption == "File" && oItem
}))
forEachU
off(event, listener, methodopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
event |
string | Indicates the event to unbind, which can either be:
|
|
listener |
object | callback | Defines the listener to remove, which can either be:
|
|
method |
string |
<optional> |
Defines an optional case-sensitive string specifying the method on the listener to remove. If not provided, the listener[type]() function is used. This parameter is ignored when the listener is a JavaScript callback function. |
- Since:
- 4.4
Example
The following example removes the select event handler from the control:
oMenu.off("select");
where oMenu is an object of Menu type.
This sample is equivalent to:
oMenu.Listeners.Remove("onselect");
The following example removes all event handlers from the control:
oMenu.off();
where oMenu is an object of Menu type.
This sample is equivalent to:
oMenu.Listeners.Clear();
or
oMenu.Listeners.Remove();
off
on(event, listener, methodopt) → {object}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
event |
string | Specifies the event to listen for or a keyboard shortcut, in one of the following forms:
|
|
listener |
object | callback | Defines the listener to add, which can either be:
|
|
method |
string |
<optional> |
Defines an optional case-sensitive string specifying the method on the listener to handle the event. If not provided, the listener[type]() function is used. This parameter is ignored when the listener is a JavaScript callback function. |
- Since:
- 4.4
Returns:
- type {string}, specifies a case-sensitive string that specifies the type of event to listen for
- do(event) {callback}, indicates a function that can be invoked to trigger the specified event for all listeners registered for that event type
- callback {callback}, defines the listener's callback function
- thisArg {any}, defines the value of this during the listener's callback execution
- lock {number}, locks or unlocks the invocation of the listener's callback
- name {string}, defines the name of the callback, mostly used for debugging purposes
- equal(oCompareListenerCallback) {callback}, indicates a function of callback(oCompareListenerCallback) {boolean} type compares the current object with the provided object. It returns true if the objects contain the same data
- Type
- object
Example
The following example logs event details when the control is selected:
oMenu.on("select", function(oEvent)
{
console.log(oEvent);
});
where oMenu is an object of Menu type.
This sample is quivalent of
oMenu.Listeners.Add("onselect", function (oEvent)
{
console.log(oEvent);
});
on
Events
onanchorclick
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
oEvent |
object | Holds information about anchor being clicked.
Properties
|
- Since:
- 2.2
Example
The following samples display information about the element being clicked:
oMenu.Listeners.Add("onanchorclick", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("anchorclick", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type.
onanchorclick
oncheck
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
Item | Indicates an object of Item type being checked. |
Example
The following samples display the item being checked:
oMenu.oncheck = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("oncheck", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("check", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
oncheck
onclose
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
object | Specifies an object of Menu type being closed. |
Example
The following samples display the popup menu which has been closed:
oMenu.onclose = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onclose", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("close", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onclose
onlayoutchange
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
Layout | Specifies an object of Layout type that specifies the control's new layout. |
Example
The following samples display a message once a new layout for the menu has been built:
oMenu.onlayoutchange = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onlayoutchange", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("layoutchange", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onlayoutchange
onmodal
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
boolean | Specifies whether the control's modal-mode starts. If true it indicates that the first float-menu is being displayed, while if false it indicates that the control displays no more any float-menus. |
Example
The following samples display a message once one or more float-menus are being displayed:
oMenu.onmodal = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onmodal", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("modal", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onmodal
onopen
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
Menu | Specifies an object of Menu type being opened. |
Example
The following samples display the popup menu which has been opened:
oMenu.onopen = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onopen", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("open", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onopen
onselect
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
Item | Indicates an object of Item type being clicked. |
Example
The following samples display the item being selected:
oMenu.onselect = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onselect", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("select", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onselect
onuncheck
Parameters:
| Name | Type | Description |
|---|---|---|
oEvent |
Item | Indicates an object of Item type being unchecked. |
Example
The following samples display the item being unchecked:
oMenu.onuncheck = function (oEvent)
{
console.log(oEvent);
}
or
oMenu.Listeners.Add("onuncheck", function (oEvent)
{
console.log(oEvent);
})
or
oMenu.on("uncheck", function (oEvent)
{
console.log(oEvent);
})
where oMenu is an object of Menu type
onuncheck