Files
Basalt/docs/objects/Frame.md
Robert Jelic 4d614372a1 Updated docs
There is still stuff to do
2022-08-28 18:18:26 +02:00

2.5 KiB

Frames are like groups or windows. You can add objects on them and if you move the frame, all its children objects will also be moved. Frames also have some special functionality to create very advanced programs.

Object methods also apply for frames.

addObject Adds a new object
setBar Sets the top bar text and colors - deprecated
setBarTextAlign Sets the top bars text align - deprecated
showBar Shows the top bar - deprecated
setMonitor Sets the frame to be a monitor frame (only for base frames)
setMirror Sets the frame to mirror onto a monitor (only for base frames)
getObject Returns the object by its name (or id)
removeObject Removes the object by its name (or id)
setFocusedObject Sets the currently focused object by this frame
removeFocusedObject Removes the currenlty focused object (it only removes beeing focused)
getFocusedObject Returns the currently focused object
setMovable Makes the frame movable (only for sub frames)
setOffset Sets the frames offset (will be added to the childrens x and y positions)
getOffset Returns the current x and y offset
addLayout Adds a new XML Layout into the frame
addLayoutFromString Adds a new XML Layout via string into the frame
getLastLayout Returns a table of all objects generated by the last addLayout/FromString method
setTheme Sets the theme of that frame and all its childrens
setScrollable Makes the frame scrollable via mousewheel (internally this uses setOffset)
setScrollAmount Sets how far the user is allowed to scroll

This is how you would implement frames via xml:

<frame>
    <frame width="parent.w * 0.5" bg="red">
        <button x="2" y="2" width="17" text="Example Button!"/>
    </frame>
    <frame x="parent.w * 0.5 + 1" width="parent.w * 0.5 +1" bg="black">
        <textfield bg="green" x="2" width="parent.w-2" />
    </frame>
</frame>