Prev | Current Page 701 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Element
The Element class is the most basic building block for the user interface library and it is included in the
ui.core package. The class is abstract and must be extended to be used; the class has no visual
representation but it is just a base to build upon. It provides many useful fields for both controls and
containers such as the mouse and key fields for intercepting the user gestures. What is really important
to understand in the Element class is how its dimensions are calculated and its positioning is managed.
The class has no x or y fields; the positioning of the element depends on the selected layouts and on the
container that the element belongs to. The layouts are set using the two fields vLayout and hLayout ;
both variables are of type Layout that is an Enum . The Layout type establishes a behavior for the
element relating to how it can stretch or adapt along a dimension. Therefore, the first variable is relative
to the vertical behavior and the latter to the horizontal one.
The exact behavior is not just the function of the Layout constructor adopted but also to the container
that includes the element; every element must be contained in a container to have a visual
representation.


Pages:
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713