Kanzi 4.1.0
TriggerConditionItem Interface Reference

Configure trigger conditions. More...

Inheritance diagram for TriggerConditionItem:
[legend]
Collaboration diagram for TriggerConditionItem:
[legend]

Properties

TriggerConditionOperation ConditionOperation [get, set]
 Gets or sets the comparison operator that you use to compare Value A to Value B:
 
object FixedPropertyValue [get, set]
 
bool IsValid [get]
 Gets the validity of the trigger condition.
 
Property MessageA [get, set]
 
Property MessageB [get, set]
 
ProjectItem ProjectItemA [get, set]
 
ProjectItem ProjectItemB [get, set]
 
Property PropertyA [get, set]
 
AnimationTargetPropertyAttributeEnum PropertyAttributeA [get, set]
 
AnimationTargetPropertyAttributeEnum PropertyAttributeB [get, set]
 
Property PropertyB [get, set]
 
new TriggerConditionItemProperties PropertyTypes [get]
 
TriggerConditionTermSourceType TermASource [get, set]
 
TriggerConditionTermSourceType TermBSource [get, set]
 Gets or sets whether the trigger condition compares to a value (Value B) that comes from a property, a message, or a fixed value:
 
- Properties inherited from ProjectItem
IEnumerable< ProjectItemChildren [get]
 Gets all child items of a project item.
 
string IconLocation [get]
 Gets the location of the icon for this project item in Kanzi Studio.
 
object IconModifier [get, set]
 Gets or sets the icon modifier for this project item.
 
string InvalidityReason [get]
 Gets the reason why this project item is in an invalid state, or null if the item is valid.
 
bool IsDeleted [get]
 Gets whether this project item has been deleted.
 
bool IsDisposed [get]
 Gets whether this project item has been disposed.
 
bool IsHidden [get, set]
 Gets or sets whether this project item is hidden in Kanzi Studio.
 
bool IsReadOnly [get, set]
 Gets or sets whether this project item is read-only.
 
bool IsValidState [get]
 Gets whether this project item is in a valid state.
 
string KzbUrl [get]
 Gets the kzb URL of a project item.
 
string Name [get, set]
 Gets or sets the name of a project item.
 
ProjectItem Parent [get, set]
 Gets or sets the parent of this project item.
 
string Path [get]
 Gets the path to this project item within the project.
 
Project Project [get]
 Gets the project in which this item is located.
 
Type ProjectItemType [get]
 Gets the type of this project item.
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project.
 
object this[Property property] [get, set]
 Gets or sets the value of the specified property on this project item.
 
object this[string propertyName] [get, set]
 Gets or sets the value of the property with the specified name on this project item.
 
string ToolTip [get]
 Gets the tooltip text for this project item in Kanzi Studio.
 
string TypeDisplayName [get]
 Gets the type of a project item.
 
- Properties inherited from PropertyContainer
IEnumerable< PropertyProperties [get]
 Gets the properties in a project item or node component.
 

Additional Inherited Members

- Public Member Functions inherited from ProjectItem
void AddProperty (Property property)
 Adds a property to an item.
 
void AddProperty (string propertyName)
 Adds a property to an item.
 
void BeginBatchModification (string batchName)
 Begins a batch modification operation.
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
void CommitBatchModification ()
 Commits the current batch modification operation.
 
bool Delete ()
 Deletes a project item.
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user.
 
IEnumerable< PropertyGetAddableProperties ()
 Gets a list of properties which you can add to an item.
 
T GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree.
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name.
 
T GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type.
 
int GetChildIndex (ProjectItem child)
 Gets the index of a child project item within this item's children collection.
 
IEnumerable< PropertyGetContextProperties ()
 Gets the context properties for this project item.
 
IEnumerable< PropertyGetFixedProperties ()
 Gets the fixed properties for this project item that cannot be removed.
 
IEnumerable< PropertyGetFrequentlyAddedProperties ()
 Gets the properties that are frequently added to this type of project item.
 
ProjectItem GetProjectItemByPath (string path)
 Gets a project item by its path relative to this project item.
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 Gets the relative path from this project item to another project item.
 
IEnumerable< PropertyGetRemovableProperties ()
 Gets a list of properties which you can remove from an item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item.
 
IEnumerable< ProjectItemGetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children.
 
bool HasProperty (Property property)
 Checks whether an item has a specific property.
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property.
 
bool IsPropertyReadOnly (Property property)
 Checks whether the specified property is read-only on this project item.
 
void RegisterThumbnailUser (object user, uint width, uint height, bool showChildren, bool showFullScreen, Node contextNode)
 Registers a user for the thumbnail images for a project item.
 
void RemoveProperty (Property property)
 Removes a property from an item.
 
void RemoveProperty (string propertyName)
 Removes a property from an item.
 
void SetChildIndex (ProjectItem child, int index)
 Sets the index of a child project item within this item's children collection.
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 Sets the read-only status of the specified property on this project item.
 
void UpdateValidity ()
 Recalculates the validity the item.
 
- Public Member Functions inherited from PropertyContainer
object Get (Property property)
 Gets the value of a property.
 
object Get (string propertyName)
 Gets the value of a property.
 
T Get< T > (TypedProperty< T > property)
 Gets the value of a property.
 
void Set (string propertyName, object value)
 Sets the value of a property.
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property.
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name.
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid.
 
- Events inherited from ProjectItem
EventHandler< CollectionChangedEventArgs< ProjectItem > > ChildCollectionChanged
 Occurs when the children collection of this project item changes.
 
EventHandler< DeletedEventArgsDeleted
 Occurs after this project item has been deleted.
 
EventHandler< DeletedEventArgsDeleting
 Occurs when this project item is about to be deleted.
 
EventHandler< CollectionChangedEventArgs< ProjectItem > > DescendantChildCollectionChanged
 Occurs when the children collection of this project item or any of its descendants changes.
 
EventHandler< DeletedEventArgsDescendantDeleted
 Occurs after a descendant of this project item has been deleted.
 
EventHandler< DynamicPropertyChangedEventArgsDescendantDynamicPropertyChanged
 Occurs when a dynamic property value changes on this project item or any of its descendants.
 
EventHandler< ParentChangedEventArgsDescendantParentChanged
 Occurs when the parent of this project item or any of its descendants changes.
 
EventHandler< CollectionChangedEventArgs< string > > DescendantPropertyCollectionChanged
 Occurs when a property is added to or removed from this project item or any of its descendants.
 
EventHandler< ProjectItemEventArgsDisposing
 Occurs when this project item is being disposed.
 
EventHandler< DynamicPropertyChangedEventArgsDynamicPropertyChanged
 Occurs when a dynamic property value changes on this project item.
 
EventHandler< ParentChangedEventArgsParentChanged
 Occurs when the parent of this project item changes.
 
EventHandler< PathChangedEventArgsPathChanged
 Occurs when the path of this project item changes.
 
EventHandler< DynamicPropertyChangedEventArgsPreviewDescendantDynamicPropertyChanged
 Occurs before a dynamic property value changes on this project item or any of its descendants.
 
EventHandler< DynamicPropertyChangedEventArgsPreviewDynamicPropertyChanged
 Occurs before a dynamic property value changes on this project item.
 
EventHandler< CollectionChangedEventArgs< string > > PropertyCollectionChanged
 Occurs when a property is added to or removed from this project item.
 
EventHandler< ReplaceEventArgsReplacing
 Occurs when this project item is being replaced.
 
EventHandler ThumbnailChanged
 Occurs when the thumbnail of this project item changes.
 
EventHandler ValidityChanged
 Occurs when the validity state of this project item changes.
 

Detailed Description

Configure trigger conditions.

Trigger conditions enable you to set which conditions must be met for the trigger to set off. For example, you can define conditions to set off a trigger when the user selects a specific item in a list box or presses a specific key on their keyboard, or to enable the user to click a button only when that button is visible, or to allow the user to scroll a Scroll View node only when a specific Page node is active.

To configure a trigger condition, define Type of A and Type of B, and a comparison operation that you use to compare Type of A to Type of B:

  • To define Type of A to come from a property, set the TermASource, ProjectItemA, PropertyA, and PropertyAttributeA properties.
  • To define Type of A to come from a message, set the TermASource and MessageA properties.
  • To define the Operation, set the ConditionOperation property.
  • To define Type of B to come from a property, set the TermBSource, ProjectItemB, PropertyB, and PropertyAttributeB properties.
  • To define Type of B to come from a message, set the TermBSource and MessageB properties.
  • To define Type of B to be a fixed value, set the TermBSource and FixedPropertyValue properties.
See also
TriggerNodeComponent, TriggerActionItem, NodeComponentHost

Examples

To create and configure a trigger condition using a value from a property:

// Create and configure a trigger condition which makes a trigger set off only
// when the Visible property of the Button 2D node is enabled:
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Button 2D node in the RootNode node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootNode.GenerateUniqueChildName("Button 2D"), rootNode);
// Add the Visible property for the Button 2D node and set it to true.
button.Set(Properties.NodeVisible, true);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger =
button.Triggers.First(
trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a property.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_PROPERTY;
// Set the node the property of which you want to compare to Button 2D.
triggerCondition.ProjectItemA = button;
// Set the property which you want to compare to Visible.
triggerCondition.PropertyA = Properties.NodeVisible;
// Set the property attribute which you want to compare.
// Because you want to compare the NodeVisible property and not its attribute, use WHOLE_PROPERTY.
triggerCondition.PropertyAttributeA = AnimationTargetPropertyAttributeEnum.WHOLE_PROPERTY;
// Set the comparison operation to =.
triggerCondition.ConditionOperation = TriggerConditionOperation.EQUALS;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// Set the fixed value to true.
triggerCondition.FixedPropertyValue = true;
}

To create and configure a trigger condition using a value from a list box message:

// Create and configure a trigger condition which makes a trigger set off only
// when the user selects any item but the first one in a Grid List Box 2D node:
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Grid List Box 2D node in the RootNode node.
var listBox =
studio.ActiveProject.CreateProjectItem<GridListBox2D>(rootNode.GenerateUniqueChildName("Grid List Box 2D"), rootNode);
// Create a List Box: Item Selected trigger in the Grid List Box 2D node.
var itemSelectedTrigger = listBox.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName("Kanzi.MessageTrigger"));
itemSelectedTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.ListBox.ItemSelected"));
// Create a trigger condition for the List Box: Item Selected trigger in the Grid List Box 2D node.
var triggerCondition = itemSelectedTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a message.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_MESSAGE;
// Set the message argument which you want to compare to the index of the selected item of the Grid List Box 2D node.
triggerCondition.MessageA = Properties.ListBoxConceptItemSelectedMessageArgumentsSelectedItemIndex;
// Set the comparison operation to !=.
triggerCondition.ConditionOperation = TriggerConditionOperation.DIFFERENT;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// Set the fixed value to 0 to make the trigger set off when the user selects any item but the first one in the Grid List Box 2D node.
triggerCondition.FixedPropertyValue = 0;
}

To create and configure a trigger condition using a value from a keyboard message:

// Create and configure a trigger condition that makes a trigger set off when the user presses the Enter key:
public void Execute(PluginCommandParameter parameter)
{
// The keyboard input code for the Enter key is 46.
// In the Kanzi UI documentation see Reference > Keyboard input codes reference.
const int EnterKeyCode = 46;
// Create a Key Pressed trigger in the Screen node.
var keyPressedTrigger = studio.ActiveProject.Screen.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName("Kanzi.MessageTrigger"));
keyPressedTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.KeyPressed"));
// Create a trigger condition for the Key Pressed trigger in the Screen node.
var triggerCondition = keyPressedTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a message.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_MESSAGE;
// Set the message argument which you want to compare to the target key.
triggerCondition.MessageA = Properties.InputMessageArgumentKey;
// Set the comparison operation to =.
triggerCondition.ConditionOperation = TriggerConditionOperation.EQUALS;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// To make the trigger set off when the user presses the Enter key, set the fixed value to the Enter key.
triggerCondition.FixedPropertyValue = EnterKeyCode;
// Create a Write Log action in the Key Pressed trigger.
var writeLogAction = keyPressedTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// In the Write Log action set Log Text to "Enter pressed".
writeLogAction.Set(Properties.WriteLogActionLogText, "Enter pressed");
// Get the Key Manipulator node component type.
var keyManipulatorType = studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.KeyManipulatorComponent);
// Create a Key Manipulator component named Key Manipulator in the Screen node.
var keyManipulator = studio.ActiveProject.Screen.CreateNodeComponent("Key Manipulator", keyManipulatorType);
// Set the Logical Key property to the Enter key.
keyManipulator.Set(Properties.KeyManipulatorComponentLogicalKey, EnterKeyCode);
}

Property Documentation

◆ ConditionOperation

TriggerConditionOperation ConditionOperation
getset

Gets or sets the comparison operator that you use to compare Value A to Value B:

  • NONE for none
  • EQUALS for =
  • DIFFERENT for !=
  • SMALLER for <
  • BIGGER for >
  • SMALLER_OR_EQUALS for <=
  • BIGGER_OR_EQUALS for >=

◆ FixedPropertyValue

object FixedPropertyValue
getset

Gets or sets the fixed value to which you want to compare.

To use this property, set TermBSource to FIXED.

See also
TermBSource

◆ IsValid

bool IsValid
get

Gets the validity of the trigger condition.

Returns
True if the trigger condition is valid, otherwise false.

◆ MessageA

Property MessageA
getset

Gets or sets the message argument which you want to compare.

To use this property, set TermASource to FROM_MESSAGE.

See also
TermASource

◆ MessageB

Property MessageB
getset

Gets or sets the message argument to which you want to compare.

To use this property, set TermBSource to FROM_MESSAGE.

See also
TermBSource

◆ ProjectItemA

ProjectItem ProjectItemA
getset

Gets or sets the project item a property of which you want to compare.

To use this property, set:

  • TermASource to FROM_PROPERTY.
  • PropertyA to the property which you want to compare
  • PropertyAttributeA to the property attribute which you want to compare
See also
TermASource, PropertyA, PropertyAttributeA

◆ ProjectItemB

ProjectItem ProjectItemB
getset

Gets or sets the node to a property of which you want to compare.

To use this property, set:

  • TermBSource to FROM_PROPERTY.
  • PropertyB to the property which you want to compare
  • PropertyAttributeB to the property attribute which you want to compare
See also
TermBSource, PropertyB, PropertyAttributeB

◆ PropertyA

Property PropertyA
getset

Gets or sets the property which you want to compare.

To use this property, set:

  • TermASource to FROM_PROPERTY
  • ProjectItemA to the project item the property of which you want to compare
  • PropertyAttributeA to the property attribute which you want to compare
See also
TermASource, ProjectItemA, PropertyAttributeA

◆ PropertyAttributeA

AnimationTargetPropertyAttributeEnum PropertyAttributeA
getset

Gets or sets the property attribute which you want to compare.

To compare the whole property instead of an attribute, use WHOLE_PROPERTY.

To use this property, set:

  • TermASource to FROM_PROPERTY
  • ProjectItemA to the project item the property of which you want to compare
  • PropertyA to the property which you want to compare
See also
TermASource, ProjectItemA, PropertyA

◆ PropertyAttributeB

AnimationTargetPropertyAttributeEnum PropertyAttributeB
getset

Gets or sets the property attribute to which you want to compare.

To compare to the whole property instead of an attribute, use WHOLE_PROPERTY.

To use this property, set:

  • TermBSource to FROM_PROPERTY
  • ProjectItemB to the project item to the property of which you want to compare
  • PropertyB to the property to which you want to compare
See also
TermBSource, ProjectItemB, PropertyB

◆ PropertyB

Property PropertyB
getset

Gets or sets the property to which you want to compare.

To use this property, set:

  • TermBSource to FROM_PROPERTY
  • ProjectItemB to the project item to the property of which you want to compare
  • PropertyAttributeB to the property attribute to which you want to compare
See also
TermBSource, ProjectItemB, PropertyAttributeB

◆ PropertyTypes

Implements ProjectItem.

◆ TermASource

TriggerConditionTermSourceType TermASource
getset

Gets or sets whether the trigger condition compares a value (Value A) that comes from a property or a message:

  • FROM_PROPERTY for property
  • FROM_MESSAGE for message

◆ TermBSource

TriggerConditionTermSourceType TermBSource
getset

Gets or sets whether the trigger condition compares to a value (Value B) that comes from a property, a message, or a fixed value:

  • FIXED for fixed value
  • FROM_PROPERTY for property
  • FROM_MESSAGE for message