RadioGroup
Classes
Class: RadioGroup
Extends Widget
A
RadioGroupwidget manages a group of radio items, allowing a single selection from multiple options. Each radio item can store a custom data value, and the group provides functions to query, update, and manage these items.Dependencies:
- EmptyWidget used for the
framefield.- CheckButton used for the
frame.checkfield.
Field: frame
RadioItem[]|nil
The internal list of radio items. Typically populated when radio items are created with
RadioGroup:CreateRadioItem.
Method: GetSize
(method) RadioGroup:GetSize()
-> size: number
Retrieves the total number of radio items in the RadioGroup.
@return
size— The number of radio items. (default:0)
Method: GetIndexByValue
(method) RadioGroup:GetIndexByValue(dataValue: number)
-> index: number
Retrieves the index of the radio item with the specified data value.
@param
dataValue— The data value to search for.@return
index— The index of the radio item, or-1if the data value doesn’t exist.
Method: IsInRange
(method) RadioGroup:IsInRange(index: number)
-> inRange: boolean
Checks if the specified index is within the valid range of the RadioGroup.
@param
index— The index to check.@return
inRange—trueif the index is in range,falseotherwise.
Method: ShowIndex
(method) RadioGroup:ShowIndex(index: number, show: boolean)
Shows or hides the radio item at the specified index in the RadioGroup.
@param
index— The index of the radio item.@param
show—trueto show the item,falseto hide it. (default:true)
Method: ReleaseCheck
(method) RadioGroup:ReleaseCheck()
Releases the check state on all radio items in the RadioGroup.
Method: UpdateValue
(method) RadioGroup:UpdateValue(index: number, data: number)
Updates the data value at the specified index in the RadioGroup.
@param
index— The index of the radio item.@param
data— The new data value to set.
Method: GetDataValue
(method) RadioGroup:GetDataValue(index: number)
-> dataValue: number|nil
Retrieves the data value for the specified index in the RadioGroup.
@param
index— The index of the radio item.@return
dataValue— The data value at the index, ornilif the index doesn’t exist.
Method: GetChecked
(method) RadioGroup:GetChecked()
-> checked: number
Retrieves the number of checked radio items in the RadioGroup.
@return
checked— The count of checked radio items. (default:-1)
Method: Clear
(method) RadioGroup:Clear()
Clears all radio data from the RadioGroup.
Method: GetCheckedData
(method) RadioGroup:GetCheckedData()
-> checkedData: number|nil
Retrieves the data value of the currently checked radio item.
@return
checkedData— The data value of the checked item, ornilif none are checked.
Method: CreateRadioItem
(method) RadioGroup:CreateRadioItem(dataValue: number)
-> radioItem: RadioItem
Creates and returns a radio item with the specified data value.
@param
dataValue— The data value for the radio item.@return
radioItem— The created radio item.
Method: EnableIndex
(method) RadioGroup:EnableIndex(index: number, enable: boolean)
Enables or disables checking for the radio item at the specified index.
@param
index— The index of the radio item.@param
enable—trueto enable checking,falseto disable.
Method: Check
(method) RadioGroup:Check(index: number)
Checks the radio item at the specified index in the RadioGroup.
@param
index— The index of the radio item to check.