- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
1.2 KiB
1.2 KiB
setSize
Changes the object size
Parameters
number|stringwidth as number or dynamicvalue as stringnumber|stringheight as number or dynamicvalue as string
Returns
objectThe object in use
Usage
- Sets the frame to have a width of 15 and a height of 12
local mainFrame = basalt.createFrame()
local subFrame = mainFrame:addFrame():setSize(15,12)
<frame width="15" height="12" />
Dynamic Values
Dynamic values can be used to automatically calculate and set the size of an object based on expressions. They can include mathematical operations and reference the size or position of other objects or the object itself. Instead of using static numbers, you can use dynamic values as strings. Here's an example of using dynamic values with setSize:
local mainFrame = basalt.createFrame()
local aButton = mainFrame:addButton("objectID")
local secondButton = mainFrame:addButton():setSize("objectID.w * 0.5", "parent.h * 0.25")
In this example, the width of secondButton is set to half the width of aButton, and its height is set to one-quarter of its parent's height. You can use parent, self, or an object ID to reference different objects when using dynamic values.