Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ButtonGetTextDimensions

From RoR Wiki

UI Lua API · Button functions
Version: WAR 1.4.8

Returns the width and height of the text on a Button.

width, height = ButtonGetTextDimensions(buttonName)

Arguments

buttonName
string – Name of a Button window.

Returns

width
number – Width of the widest line of text.
height
number – Height of all lines: the number of lines times the line height.

Details

  • The values are measured the same way as LabelGetTextDimensions, from the button's text label, and are divided by the label's scale.
  • If the button has no text label, the two returned numbers are not meaningful.

Errors

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

Example

Measuring a context-menu entry, from ea_contextmenu/source/contextmenu.lua:

local x, _ = ButtonGetTextDimensions( menuItemWindowName )

From ea_tomeofknowledge/source/tomewindow_rewards.lua:

local _, height = ButtonGetTextDimensions( entryWindowName.."Text" )

See also