Class DataDrivenExclusiveActivityHost3D

Class Hierarchy
  • KanziObject
  •  └─ Node
  •        └─ Node3D
  •              └─ ContentLayout3D
  •                    └─ DataDrivenExclusiveActivityHost3D

A type of Exclusive Activity Host node, that uses a list of Activity nodes provided by setting a list DataObject, from a DataSource, to the ActivitySourceProperty property. A child Activity node of a Data-Driven Exclusive Activity Host uses the prefab set in the ActivityTemplateProperty.

An Activity Host node defines the rules for when its Activity nodes are active. Kanzi has these Activity Host nodes:

  • Data-Driven Exclusive Activity Host and Exclusive Activity Host nodes can have only one of its child Activity nodes active at a time. When one child Activity node of a Data-Driven Exclusive Activity Host or an Exclusive Activity Host node is active, all other Activity nodes of that Activity Host node are inactive.

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 ExclusiveActivityHost2D and ExclusiveActivityHost3D.

  • Parallel Activity Host node can activate more than one of its child Activity nodes at a time.

See ParallelActivityHost2D and ParallelActivityHost3D.

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 that application. For example, you can use the Kanzi Engine 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 ExclusiveActivityHost2D, ExclusiveActivityHost3D, Activity2D, and Activity3D.

Controlling Activity nodes in a Data-Driven Exclusive Activity Host node The type of the Activity Host node determines the way you control its child Activity nodes. When you use an Data-Driven Exclusive Activity Host node, you can control its Activity nodes using:

  • Implicit state control. You can enable navigation with keys and touch that implicitly controls which Activity nodes are active and inactive.

  • Explicit state control. To activate an Activity node explicitly, use one of these approaches:

  • Activate an Activity node created by an ActivitySourceProperty by setting the ActiveActivityIndexProperty.

  • Activate an Activity node that you manually added to an Activity Host node:

  • In the Activity Host node to which you manually added an Activity node create any Trigger.

  • Add to the DataTrigger a condition that defines when an Activity node is activated. For example, use the value of an Activity Property.

  • Activate the Activity node using the ActivateActivityMessage.

  • Synchronize the activation of an Activity node with your logic:

  • In an Activity Host node create a DataTrigger.

  • In the DataTrigger add a condition expression which evaluates to true or false, and which uses as input either Properties or a Data Source.

  • Add to the DataTrigger an ApplyPropertyAction that activates an Activity node by setting the value of the ActiveActivityIndexProperty. 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 value of the ActiveActivityIndexProperty. See DataTrigger and ApplyPropertyAction.

  • Activate an Activity node on an event, as a one-time action:

  • In an Activity Host node create any Trigger.

  • Add to the Trigger a SetPropertyAction that changes the ActiveActivityIndexProperty to activate an Activity node.

  • Add to the Trigger a condition that, when met, sets off a the SetPropertyAction.

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 ApplyPropertyAction that sets the ActiveActivityIndexProperty to some value and any other Trigger with a SetPropertyAction that sets that same property to a different value, the effect of the SetPropertyAction becomes visible only after Kanzi unapplies the ApplyPropertyAction. See Trigger and SetPropertyAction.

Data and logic programming of Activity nodes For each Data-Driven Exclusive Activity Host node you can define properties that are specific to that Data-Driven Exclusive Activity Host node. For example, with Data-Driven Exclusive Activity Host node that is attached to a music player, you can toggle music on and off, and change the volume level.

When you create a property for a Data-Driven 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 a Data-Driven Exclusive Activity Host, Kanzi adds the properties of that Data-Driven 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 a Data-Driven Exclusive Activity Host is virtual. When Kanzi virtualizes a Data-Driven Exclusive Activity Host, it serializes the properties of that Data-Driven Exclusive Activity Host and when Kanzi devirtualizes that Data-Driven Exclusive Activity Host, it deserializes the state of that Data-Driven Exclusive Activity Host and restores its property values.

Code behind Code behind is a workflow where you associate code with an instance of a Data-Driven Exclusive Activity Host instead of a type. In Kanzi Studio in the Activity Browser window, you can generate a code behind stub for any Data-Driven Exclusive Activity Host node. This stub is associated with that particular Data-Driven Exclusive Activity Host and has access to the properties of that Data-Driven 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:

  • Connect to a remote service when the Data-Driven Exclusive Activity Host is instantiated and attached.
  • Install Kanzi command handlers and define their implementations, such as increase the volume when the user presses a button.
  • Implement complex UI interaction, such as drag-and-drop of data between UI elements.

Use a Data-Driven Exclusive Activity Host 3D, with a data source, to generate Activity 3D nodes from the content of data objects. A Data-Driven Exclusive Activity Host defines the rules when its Activity nodes are active. Each can have only one of its child Activity nodes active at a time

Inherits properties and message types from DataDrivenExclusiveActivityHost3DMetadata.

Synopsis

Methods
create()

Creates a Data-Driven Exclusive Activity Host 3D node

DataDrivenExclusiveActivityHost3D.DataDrivenExclusiveActivityHost3D:create(name)

Creates a Data-Driven Exclusive Activity Host 3D node.

Parameters
name (string)

The name of the node.