ExclusiveActivityHost2D
¶
An Activity Host that displays Activity nodes one at a time.
An Activity Host node defines the rules for when its Activity nodes are active. Kanzi has these Activity Host nodes:
For example, you can use a Data-Driven Exclusive Activity Host or an Exclusive Activity Host node to toggle between views in your application.
See DataDrivenExclusiveActivityHost2D and DataDrivenExclusiveActivityHost3D.
See ParallelActivityHost2D and ParallelActivityHost3D.
For example, you can use an Exclusive Activity Host node to toggle between views in your application.
You can add Activity nodes to an Activity Host node in real-time. This enables you to use the Kanzi Engine API to generate Activity nodes or to add to the application another application for which the structure of Activity nodes is not known until you run the application. For example, you can use the API to generate a large number of menu pages that you want to show to the user.
The Activity and Activity Host nodes inherit from the ContentLayout class to lay out their content like a Content Layout node. See ContentLayout2D and ContentLayout3D.
See Activity2D and Activity3D.
Controlling Activity nodes in an Exclusive Activity Host node The type of the Activity Host node determines the way you control its child Activity nodes. When you use an Exclusive Activity Host node, you can control its Activity nodes using:
The Activity node stays active as long as the condition expression in the DataTrigger evaluates to true. When the condition in the DataTrigger is no longer true, Kanzi reverts the activation. When using this approach, keep in mind that actions of a DataTrigger have higher priority than the actions of any other Trigger. See DataTrigger, ApplyPropertyAction, and ApplyActivationAction.
When using this approach, keep in mind that actions of a DataTrigger have higher priority than the actions of any other Trigger. For example, if you use a DataTrigger with an ApplyActivationAction to activate an Activity node and you use any other Trigger to send an ActivateActivityMessage, the effect of the ActivateActivityMessage becomes visible only after Kanzi unapplies the ApplyActivationAction. See Trigger.
Data and logic programming of Activity nodes For each Exclusive Activity Host node you can define properties that are specific to that Exclusive Activity Host node. For example, Exclusive Activity Host node for a music player keeps currently selected player type.
When you create a property for an Exclusive Activity Host node, set the namespace of that property to Activity Property. You can create properties with int, bool, float, and enum data types. If you use code behind for an Exclusive Activity Host, Kanzi adds the properties of that Exclusive Activity Host to the code behind.
The values of these properties implement the state machine and logic of your Kanzi application, which is why Kanzi preserves the values of these properties even when an Exclusive Activity Host is virtual. When Kanzi virtualizes an Exclusive Activity Host, it serializes the properties of that Exclusive Activity Host and when Kanzi devirtualizes that Exclusive Activity Host, it deserializes the state of that Exclusive Activity Host and restores its property values.
Code behind Code behind is a workflow where you associate code with an instance of an Exclusive Activity Host instead of a type. In Kanzi Studio in the Activity Browser window, you can generate a code behind stub for any Exclusive Activity Host node. This stub is associated with that particular Exclusive Activity Host and has access to the properties of that Exclusive Activity Host. In code behind you can write code that you can associate with the view or controller parts of the model-view-controller pattern. For example, you can:
Fallback state When an Exclusive Activity Host is in Fallback state, none of its Activities are instantiated.
You can use Fallback state to implicitly hide Activities in an Exclusive Activity Host. For example, to automatically hide Activities that make an application menu when their Exclusive Activity Host loses focus, use the Fallback state with the FocusScopeType::AutoClosingModal.
You can add Fallback state to an Exclusive Activity Host, like any other Activity, by setting the ExclusiveActivityHostConcept::ExclusiveActivityHostContentProperty. You can control the Fallback state, like any other state of an Exclusive Activity Host, with the ActivateActivityMessage, ApplyActivationAction, or through direct value matching.
Use an Exclusive Activity Host 2D to define the rules when its Activity nodes are active. An Exclusive Activity Host 2D can have only one of its child Activity nodes active at a time
Inherits properties and message types from ExclusiveActivityHost2DMetadata.
Creates a 2D Exclusive Activity Host node.
| name | (string) | The name of the node. |