Skip to content

MenuOption

The MenuOption class represents a menu option instance and provides APIs for reading, updating, and customizing it.


Methods

GetOptionID()number

Retrieves the option id.

Returned:

  • number - The requested option id.

GetType()Enum.MenuOptionType

Retrieves the type.

Returned:


IsFolder()boolean

Checks whether it is folder.

Returned:

  • boolean - True if the condition is met, false otherwise.

OnChange(func: MenuOptionChangeCallback<T>, initCall?: boolean)this

Register a function to be called when the option value changes.

  • funcMenuOptionChangeCallback<T> - function to call when option value changes
  • initCallboolean (optional) - if true, function will be called with current value for initialization useful if your chain registration not end with GetValue (default is false)

IMPORTANT

useful if your chain registration not end with GetValue

Returned:

  • this - this instance, allowing method chaining

GetValue()T

Retrieves the specified console variable value.

Returned:

  • T - The requested value.

SetValue(value: T)this

Sets the specified console variable value.

  • valueT - The value to set or use.

Returned:

  • this - The current instance for chaining.

GetSlotValueByIndex(index: number)boolean

Retrieves the slot value by index.

  • indexnumber - The index.

IMPORTANT

can only be used with ToggleBlock, MultiSelect or MultiComboBox

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotValueByIndex(index: number, value: boolean)this

Sets the slot value by index.

  • indexnumber - The index.
  • valueboolean - The value to set or use.

IMPORTANT

can only be used with ToggleBlock, MultiSelect or MultiComboBox

Returned:

  • this - The current instance for chaining.

GetSlotValueByKey(key: string)boolean

Retrieves the slot value by key.

  • keystring - The key.

IMPORTANT

can only be used with ToggleBlock, MultiSelect or MultiComboBox

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotValueByKey(key: string, value: boolean)this

Sets the slot value by key.

  • keystring - The key.
  • valueboolean - The value to set or use.

IMPORTANT

can only be used with ToggleBlock, MultiSelect or MultiComboBox

Returned:

  • this - The current instance for chaining.

GetBindedValue(){ value: T }

Return object with value that will be updated when option value changes, will help to avoid explicit registration of OnChange

Returned:

  • { value: T } - The requested binded value.

GetPrioritySelectValue()string[]

Retrieves the priority select value.

Returned:

  • string[] - An array with the matching values.

SetTip(text: string, locale?: LocaleVariant)this

Set text that will be shown under the option

  • textstring - text to show
  • localeLocaleVariant (optional) - text locale, default is "en"

Returned:

  • this - this instance, allowing method chaining

SetTip2(text: string, locale?: LocaleVariant)this

Set text that will be shown if you hover over the option

  • textstring - text to show
  • localeLocaleVariant (optional) - text locale, default is "en"

Returned:

  • this - this instance, allowing method chaining

SetTip2Title(text: string, locale?: LocaleVariant)this

Set title that will be shown if you hover over the option

  • textstring - text to show
  • localeLocaleVariant (optional) - text locale, default is "en"

Returned:

  • this - this instance, allowing method chaining

SetTip2Image(imagePath: string)this

Set image that will be shown if you hover over the option

  • imagePathstring - path to the image

Returned:

  • this - this instance, allowing method chaining

SetColumn(value: number)this

Sets the column.

  • valuenumber - 0 - left, 1 - right

IMPORTANT

This will not work if used MergeWithNext

Returned:

  • this - this instance, allowing method chaining

GetColumn()number

Retrieves the column.

Returned:

  • number - The requested column.

SetMergeWithNext(value: boolean)this

Sets the merge with next.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

MergeWithNext()this

Merges this option with the next one in one group.

Returned:

  • this - this instance, allowing method chaining

IsMergedWithNext()boolean

Checks whether it is merged with next.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetTipLocale(locale: LocaleVariant, text: string)this

Sets the tip locale.

  • localeLocaleVariant - The locale to use.
  • textstring - The text value.

IMPORTANT

do same as SetTip

Returned:

  • this - The current instance for chaining.

SetComboBoxLocale(locale: LocaleVariant, values: string[])this

Set translated string values for combobox

  • localeLocaleVariant - locale of the values
  • valuesstring[] - array of translated values

Returned:

  • this - this instance, allowing method chaining

SetNameLocale(locale: LocaleVariant, name: string)this

Set translated option name

  • localeLocaleVariant - locale of the name
  • namestring - translated name

Returned:

  • this - this instance, allowing method chaining

SetGeneral(value: boolean)this

Set the option as general for their group, if this option is toggled off, all other options in the group will be disabled

  • valueboolean - The value to set or use.

IMPORTANT

works only with toggle options, this option should be the first one in the group

Returned:

  • this - this instance, allowing method chaining

IsGeneral()boolean

Checks whether it is general.

IMPORTANT

See SetGeneral

Returned:

  • boolean - True if the condition is met, false otherwise.

SetGeneralForTab(value: boolean)this

Sets the general for tab.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsGeneralForTab()boolean

Checks whether it is general for tab.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetHidden(value: boolean)this

Sets the hidden.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsHidden()boolean

Checks whether it is hidden.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotHiddenByIndex(slot: number, value: boolean)this

Sets the slot hidden by index.

  • slotnumber - The slot.
  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsSlotHiddenByIndex(slot: number)boolean

Checks whether it is slot hidden by index.

  • slotnumber - The slot.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotHiddenByKey(key: string, value: boolean)this

Sets the slot hidden by key.

  • keystring - The key.
  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsSlotHiddenByKey(key: string)boolean

Checks whether it is slot hidden by key.

  • keystring - The key.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetName()string

Retrieves the name.

Returned:

  • string - The requested name.

GetNameTranslated()string

Retrieves the name translated.

Returned:

  • string - The requested name translated.

GetChilds()MenuOption<any>[]

Retrieves the childs.

Returned:

  • MenuOption<any>[] - An array with the matching values.

IsKeyDownOnce(checkInputCapture?: boolean)boolean

Checks whether the specified key was pressed once.

  • checkInputCaptureboolean (optional) - The check input capture.

Returned:

  • boolean - True if the condition is met, false otherwise.

IsKeyDown(checkInputCapture?: boolean)boolean

Checks whether the specified key is currently held down.

  • checkInputCaptureboolean (optional) - The check input capture.

Returned:

  • boolean - True if the condition is met, false otherwise.

GetKeyString()string

Retrieves the key string.

Returned:

  • string - The requested key string.

SetImage(imagePath: string)this

Sets the image.

  • imagePathstring - The image path.

Returned:

  • this - The current instance for chaining.

SetDisabled(value: boolean)this

Sets the disabled.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsDisabled()boolean

Checks whether it is disabled.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotDisabledByIndex(slot: number, value: boolean)this

Sets the slot disabled by index.

  • slotnumber - The slot.
  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsSlotDisabledByIndex(slot: number)boolean

Checks whether it is slot disabled by index.

  • slotnumber - The slot.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetSlotDisabledByKey(key: string, value: boolean)this

Sets the slot disabled by key.

  • keystring - The key.
  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsSlotDisabledByKey(key: string)boolean

Checks whether it is slot disabled by key.

  • keystring - The key.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetNoTitle(value: boolean)this

Sets the no title.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

IsNoTitle()boolean

Checks whether it is no title.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetToggleBlockTipsTranslated(locale: LocaleVariant, hints: string[])this

Sets the toggle block tips translated.

  • localeLocaleVariant - The locale to use.
  • hintsstring[] - The hints.

Returned:

  • this - The current instance for chaining.

SetNotStrictAlign(value: boolean)this

Sets the not strict align.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

SetToggleBlockLocale(locale: LocaleVariant, values: string[])this

Sets the toggle block locale.

  • localeLocaleVariant - The locale to use.
  • valuesstring[] - The values to use.

Returned:

  • this - The current instance for chaining.

SetFolderTitleTranslated(locale: LocaleVariant, title: string)this

Sets the folder title translated.

Returned:

  • this - The current instance for chaining.

SetNotDrawLabelAndHint(value: boolean)this

Sets the not draw label and hint.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

NotDrawLabelAndHint()this

Provides access to not draw label and hint.

Returned:

  • this - The current instance for chaining.

GetNotDrawLabelAndHint()boolean

Retrieves the not draw label and hint.

Returned:

  • boolean - True if the condition is met, false otherwise.

SetTabModeForFolder(value: boolean)this

Sets the tab mode for folder.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

GetTabModeForFolder()boolean

Retrieves the tab mode for folder.

Returned:

  • boolean - True if the condition is met, false otherwise.

AddAliases(aliases: Array<string>)this

Adds the aliases.

  • aliasesArray<string> - The aliases.

Returned:

  • this - The current instance for chaining.

SaveValue()this

Provides access to save value.

Returned:

  • this - The current instance for chaining.

LoadValue(processCallbacks?: boolean)this

Loads the value.

  • processCallbacksboolean (optional) - The process callbacks.

Returned:

  • this - The current instance for chaining.

GetConfigKey()string

Retrieves the config key.

Returned:

  • string - The requested config key.

GetGeneratedConfigKey()string

Retrieves the generated config key.

Returned:

  • string - The requested generated config key.

SetOverridenConfigKey(key: string)this

Sets the overriden config key.

  • keystring - The key.

Returned:

  • this - The current instance for chaining.

SetOrdering(value: number)this

Sets the ordering.

  • valuenumber - The value to set or use.

Returned:

  • this - The current instance for chaining.

GetOrdering()number

Retrieves the ordering.

Returned:

  • number - The requested ordering.

SetKeyDown(value: boolean)this

Sets the key down.

  • valueboolean - The value to set or use.

Returned:

  • this - The current instance for chaining.

SetWheelStopReason(stopReason: Enum.WheelStopReason, maxTimePressInS?: number)this

Sets the wheel stop reason.

  • stopReasonEnum.WheelStopReason - The stop reason.
  • maxTimePressInSnumber (optional) - The max time press in s.

Returned:

  • this - The current instance for chaining.

RemoveOption()void

Removes the option.