A node builder that constructs a SizeLock node. sizeLock can be used with other node builders, for example sizeLock!vframe() will use a vertical frame as its base, while sizeLock!hframe() will use a horizontal frame.
SizeLock "locks" the size of a node, limiting the amount of space it will use from the space it is given.
The sizeLimit node property sets the maximum amount of space a SizeLock node can use. sizeLimit can only be used with SizeLock.
This node property defines the maximum size for a SizeLock node. Nodes can be given a limit by setting either width or height.
Size limit can be used to center content on a wide screen. By using sizeLock!node, .layout!"center" and .sizeLimitX, we can create space around the node for comfortable reading.
import fluid; sizeLock!vframe( .sizeLimitX(400), // Maximum width of 800 px .layout!(1, "center"), // Use excess space to center the node label( "By using sizeLock and setting the right limit, a node can be " ~ "forced to use a specific amount of space. This can make your " ~ "app easier to use on a wide screen, without affecting smaller " ~ "windows or displays." ), );
Size locking allows placing restrictions on the size of a node. Using the SizeLock node template, one can set limits on the maximum size of a node.
Normally, nodes default to using the least space they can: the bare minimum they need to display correctly. If their Node.layout.align property is set to fill, they will instead attempt to use all of the space they're given. Using SizeLock allows for a compromise by placing a limit on how much space a node can use.
Note: Using layout!"fill" with SizeLock will negate the lock's effect. Use a different alignment like "start", "center" or "end".