Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ButtonSetPressedFlag

From RoR Wiki

UI Lua API · Button functions
Version: WAR 1.4.8

Sets or clears the pressed state of a Button.

ButtonSetPressedFlag(buttonName, pressed)

Arguments

buttonName
string – Name of a Button window.
pressed
boolean – true to show the button pressed, false to release it.

Returns

Nothing.

Details

  • This is how the stock UI checks and unchecks check boxes and shows toggle buttons as active.
  • The button's text colour changes to the colour set for its new state (see ButtonSetTextColor).
  • The client also changes the flag when the button is clicked (see ButtonGetPressedFlag).
  • pressed must be a real boolean. Passing nil or a number raises an Invalid Parameters error.
  • The function needs at least two arguments and only reads the last two.

Errors

  • Error in function call 'ButtonSetPressedFlag': Window %s does not exist
  • Error in function call 'ButtonSetPressedFlag': Window %s is not a Button

Example

Showing a window's toolbar button as pressed while the window is open, from easystem_windowutils/source/windowutils.lua:

for index, buttonName in ipairs(  WindowUtils.stateButtons[ windowName ] ) do
    ButtonSetPressedFlag( buttonName, true )
end

See also