Pop.Box/docs/Elements.md
2016-04-04 20:59:42 -07:00

1.2 KiB

Elements

Elements are the core of Pop.Box.

Once pop has been required, you can create Elements and interact with them. Most elements can be created like this: local box = pop.box(...)

However, if an element's name clashes with a function name used in Pop.Box, you will have to use pop.create(type, ...) where type is a string naming the element type. (No standard elements do this.)

When creating an element, the first argument is its parent element. If the first argument is not an element, it will be treated as the second argument. If it is false, then an element with no parent will be created.

When no parent is specified, an element's parent is pop.screen, which is the top-level element of Pop.Box. (This behavior can be modified by custom elements, so check their documentation.)

Available Elements

  • Element (The base of all elements, and useful for alignment.)
  • Box (A box, can be colored, or display a supported Drawable.)
  • Text (Plain text, no special features. Useful for basic labels and such.)
  • Window (A moveable window. Has a title and area for other elements.)