Skip to content

OryUIButtonGroup

Kevin Cross edited this page Jun 28, 2020 · 16 revisions

Available Functions

OryUICreateButtonGroup(parameters$)

Creates a button group and returns a button group ID. See Available Parameters section below for the options.

OryUIDeleteButtonGroup(buttonGroupID)

Deletes a button group.

OryUIGetButtonGroupHeight(buttonGroupID)

Returns the height of the button group.

OryUIGetButtonGroupItemCount(buttonGroupID)

Returns the number of buttons in the button group.

OryUIGetButtonGroupItemHeight(buttonGroupID, itemID)

Returns the height of the button in the button group.

OryUIGetButtonGroupItemPressedByIndex(buttonGroupID, itemID)

Returns whether or not a specific button in the button group is being pressed.

OryUIGetButtonGroupItemPressedByName(buttonGroupID, itemName$)

Returns whether or not a specific button in the button group is being pressed.

OryUIGetButtonGroupItemReleasedByIndex(buttonGroupID, itemID)

Returns whether or not a specific button in the button group was released.

OryUIGetButtonGroupItemReleasedByName(buttonGroupID, itemName$)

Returns whether or not a specific button in the button group was released.

OryUIGetButtonGroupItemReleasedIndex(buttonGroupID)

Returns the button number (itemID) that was released.

OryUIGetButtonGroupItemReleasedName(buttonGroupID)

Returns the button name (itemID) that was released.

OryUIGetButtonGroupItemSelectedIndex(buttonGroupID)

Returns the button number (itemID) that is selected.

OryUIGetButtonGroupItemSelectedName(buttonGroupID)

Returns the button name (itemName$) that is selected.

OryUIGetButtonGroupItemWidth(buttonGroupID, itemID)

Returns the width of the button in the button group.

OryUIGetButtonGroupWidth(buttonGroupID)

Returns the width of the button group.

OryUIGetButtonGroupX(buttonGroupID)

Returns the x position of the button group.

OryUIGetButtonGroupY(buttonGroupID)

Returns the y position of the button group.

OryUIInsertButtonGroupItem(buttonGroupID, index, parameters$)

Inserts a button into the button group at the chosen location. At the moment -1 is the only accepted index, which will put a new button at the end of the list.

OryUIInsertButtonGroupListener(buttonGroupID)

Required to update the selected and unselected styling to each button in the button group.

OryUISetButtonGroupItemCount(buttonGroupID)

Sets the number of buttons in the button group. Will remove or add buttons to the required amount.

OryUISetButtonGroupItemSelectedByIndex(buttonGroupID, itemID)

Sets which button is selected in the button group i.e. setting one as selected by default.

OryUISetButtonGroupItemSelectedByName(buttonGroupID, itemName$)

Sets which button is selected in the button group i.e. setting one as selected by default.

OryUIUpdateButtonGroup(buttonGroupID, parameters$)

Updates a button group. See Available Parameters section below for the options.

OryUIUpdateButtonGroupItem(buttonGroupID, itemID, parameters$)

Updates a specific button in a button group. See Available Parameters section below for the options.

Available Parameters (all optional)

Parameter Description
depth The depth of the button group.
height The height of the button group. Accepts decimals.
icon The icon to show on the button. See the list of Available Icons
iconID Apply a custom icon to the button. Requires a LoadImage() value/id.
iconPlacement The position to place the icon when text is also on the button. Accepts the values left, right, top and bottom.
iconSize The width and height of the icon, comma delimited. Also accepts -1 in either one to create a square icon. Accepts decimals.
name The name/id to give to the button.
offset The x and y position where the offset should be placed, comma delimited. Also accepts a single value 'center'. Accepts decimals.
position The x and y position where the button group should be placed, comma delimited.
selected If the button is selected. Accepts the values true, false, 0, and 1.
selectedColor The colour of the button if selected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
selectedIconColor The colour of the button icon if selected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
selectedTextBold If the text is bold when button selected. Accepts the values true, false, 0, and 1.
selectedTextColor The colour of the button text if selected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
selectedTextSize The size of the button text if selected. Accepts decimals.
size The width and height of the button group, comma delimited. Also accepts -1 in either one to create a square button. Accepts decimals.
text The text shown on the button.
textBold If the text is bold. Accepts the values true, false, 0, and 1.
textColor The colour of the button text. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
textSize The size of the button text. Accepts decimals.
unselectedColor The colour of the button if unselected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
unselectedIconColor The colour of the button icon if unselected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
unselectedTextBold If the text is bold when button unselected. Accepts the values true, false, 0, and 1.
unselectedTextColor The colour of the button text if unselected. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
unselectedTextSize The size of the button text if unselected. Accepts decimals.
width The width of the button group. Accepts decimals.
x The x position where the button group should be placed.
y The y position where the button group should be placed.

Example Code

To create a default button group with no styling (this is just a container and has no buttons)

grpStatus = OryUICreateButtonGroup("")

To update an existing button group

OryUIUpdateButtonGroup(grpStatus, "width:90;offset:center;position:50,50;selectedColor:22,160,133,255;unselectedColor:149,165,166,255;depth:18")

You can also create a button group with the required settings with the OryUICreateButtonGroup function

grpStatus = OryUICreateButtonGroup("width:90;offset:center;position:50,50;selectedColor:22,160,133,255;unselectedColor:149,165,166,255;depth:18")

To add buttons to a button group. Each time a button is added that and all existing buttons in the group resize evenly

OryUIInsertButtonGroupItem(grpStatus, -1, "text:Available")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Busy")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Sleeping")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Invisible")

A listener is required to listen for button presses and to change the selected value

OryUIInsertButtonGroupListener(grpStatus)

To check if specific button is selected

if (OryUIGetButtonGroupItemSelected(grpStatus) = 1)
    print("Available Selected")
endif

Example

grpStatus = OryUICreateButtonGroup("width:90;offset:center;position:50,50;selectedColor:22,160,133,255;unselectedColor:149,165,166,255;depth:18")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Available")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Busy")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Sleeping")
OryUIInsertButtonGroupItem(grpStatus, -1, "text:Invisible")
OryUISetButtonGroupItemSelectedByIndex(grpStatus, 1)

do
    OryUIInsertButtonGroupListener(grpStatus)
    if (OryUIGetButtonGroupItemSelectedIndex(grpStatus) = 1) then print("Available Selected")
    if (OryUIGetButtonGroupItemSelectedIndex(grpStatus) = 2) then print("Busy Selected")
    if (OryUIGetButtonGroupItemSelectedIndex(grpStatus) = 3) then print("Sleeping Selected")
    if (OryUIGetButtonGroupItemSelectedIndex(grpStatus) = 4) then print("Invisible Selected")

    Sync()
loop

Clone this wiki locally