Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:WindowGetId

From RoR Wiki

UI Lua API · Window functions
Version: WAR 1.4.8

Returns the number stored on a window as its id.

id = WindowGetId(windowName)

Arguments

windowName
string – Name of the window.

Returns

id
number – The window's id, a whole number.

Details

  • The id is a free number for the UI's own use. It is set with WindowSetId.
  • A common use is to find out which of several similar windows triggered an event handler, by reading the id of SystemData.ActiveWindow.name or one of its parents.

Errors

  • Error in function call 'WindowGetId': Window %s does not exist

Example

Finding the dialog that a clicked button belongs to, from easystem_dialogmanager/source/dialogmanager.lua:

function DialogManager.OnOneButtonDlgButton1()
    local dlgIndex = WindowGetId( WindowGetParent( WindowGetParent(SystemData.ActiveWindow.name) ) )
    -- ...
end

See also