API:WindowResizeOnChildren
From RoR Wiki
UI Lua API · Window functions
Version: WAR 1.4.8
Resizes a window so that its right and bottom edges enclose its child windows.
WindowResizeOnChildren(windowName, recurse, borderSpacing)
Arguments
- windowName
string– Name of the window to resize.- recurse
boolean–trueto also look at the children of the children, all the way down.- borderSpacing
number– Extra space added to the right and bottom.
Returns
Nothing.
Details
- The client finds the right-most and bottom-most edge of the child windows, adds
borderSpacing, and sets the window's width and height so that its right and bottom edges are there. The window's top-left corner does not move. - The window can grow or shrink.
- Only child windows whose showing flag is set and which have fewer than two anchors are measured. Children with two or more anchors (for example ones stretched across the window) are ignored.
- With
recurse = true, the children of measured children are measured as well. - The new size is set as with WindowSetDimensions, so the same limits and side effects apply. The window's own anchors are processed afterwards.
- The stock UI shows a dialog before calling this function on it. Its comment says that it does not work otherwise.
- The No window specified error exists in the client but cannot be raised: a missing name is replaced by an empty string first, which gives the does not exist error.
Errors
Error in function call 'WindowResizeOnChildren': Window %s does not exist.Error in function call 'WindowResizeOnChildren': Window %s is currently locked and may not be modified from lua. ...
This check never triggers in the current client. See WindowSetShowing.
Example
From easystem_dialogmanager/source/dialogmanager.lua:
-- Show the Dialog. -- This must be done before WindowResizeOnChildren -- it doesn't work otherwise. WindowSetShowing( "OneButtonDlg"..dlgIndex, true ) WindowResizeOnChildren( "OneButtonDlg"..dlgIndex.."Box", false, 10 )
