TMultiView serves as a container for a group of TView controls, which can be retrieved by the Views property. Each view contains child controls. TMultiView determines which view and its child controls are visible. At any time, at most one view is visible (called active). To make a view active, set ActiveView or ActiveViewIndex. Note, by default there is no active view.
To add a view to TMultiView, manipulate the Views collection or add it in template as follows,
view 1 content
view 2 content
TMultiView responds to the following command events to manage the visibility of its views.
- NextView : switch to the next view (with respect to the currently active view).
- PreviousView : switch to the previous view (with respect to the currently active view).
- SwitchViewID : switch to a view by its ID path. The ID path is fetched from the command parameter.
- SwitchViewIndex : switch to a view by its zero-based index in the Views collection. The index is fetched from the command parameter.
Upon postback, if the active view index is changed, TMultiView will raise an OnActiveViewChanged event.
The Hangman game is a typical use of TMultiView. The following example demonstrates another usage of TMultiView.