Prev | Current Page 907 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Unlike other containers, the Tab control requires all child Control objects to be appended at the same
time when the Tab control is instantiated. You do this by storing these objects into an array of type
Control , then passing the array as a parameter to the instantiation. You cannot append further objects
to the Tab control itself once the Tab control is instantiated.
var tabControl = new Tabs( objectsArray );
The Tab control provides the single event, onChange . This event is called whenever a new tab is clicked
and is passed two parameters; the first is the title of the newly selected tab and the second is the title of
the old tab. The event function expects an integer return value, though you should derive this from the
appropriate ReturnType enumerator. Therefore, if you return IGNORE , the old tab should remain
selected.
The following is an example of the Tab control in action. Figure 17 - 6 shows how this example might
appear when run.
import nGui.controls.Button;
import nGui.controls.Control;
import nGui.


Pages:
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919